/**
  * Method to clean the html
  * @param string $html the html
  * @return string the clean scrubbed html
  * @access public
  * @author Wesley Nitsckie
  */
 public function cleanHtml($html = NULL)
 {
     if (is_null($html)) {
         return $html;
     } else {
         return $this->_objSafeHtml->parse($html);
     }
 }
Example #2
0
 /**
  * Generate the checkout step
  * @return  string
  */
 public function generate()
 {
     $blnValidate = \Input::post('FORM_SUBMIT') == $this->objModule->getFormId();
     $this->Template->class = $this->getStepClass();
     $this->Template->tableless = $this->objModule->tableless;
     $this->Template->options = $this->generateOptions($blnValidate);
     $this->Template->fields = $this->generateFields($blnValidate);
     return $this->Template->parse();
 }
Example #3
0
 /**
  * Constructs a new config instance
  *
  * Parse for muse configuration file from user home directory
  *
  * @return  void
  **/
 public function __construct()
 {
     // Build path
     $home = getenv('HOME');
     $path = $home . DS . '.muse';
     $this->path = $path;
     $this->config = new Registry();
     // See if there's an existing file
     if (is_file($path)) {
         $this->config->parse($path);
     }
 }
Example #4
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $departure = $this->argument('departure');
     $arrival = $this->argument('arrival');
     $datetime = $this->argument('date');
     // Check if we have a white space, or else the parser will complain
     if (!strpos($datetime, ' ')) {
         exit("Date must be in format yyyy-mm-dd hh:mm:ss.\n");
     }
     $this->parser->setParameters($departure, $arrival, $datetime);
     $results = $this->parser->parse();
     $this->displayResults($results);
 }
Example #5
0
 /**
  * shows The settings page
  *
  * @global $_ARRAYLANG, $objDatabase
  * @access private
  *
  */
 function _showSettings()
 {
     global $objDatabase, $_ARRAYLANG, $_CONFIG;
     $this->_getFieldNames();
     $domain1 = $_CONFIG['domainUrl'];
     $domain2 = $this->_getDomain($_CONFIG['domainUrl']);
     $this->_pageTitle = $_ARRAYLANG['TXT_IMMO_SETTINGS'];
     $this->_objTpl->loadTemplateFile('module_immo_settings.html');
     $this->_objTpl->setGlobalVariable(array('TXT_IMMO_TYPE' => $_ARRAYLANG['TXT_IMMO_TYPE'], 'TXT_IMMO_ORDER' => $_ARRAYLANG['TXT_IMMO_ORDER'], 'TXT_IMMO_TYPE_TEXT' => $_ARRAYLANG['TXT_IMMO_TYPE_TEXT'], 'TXT_IMMO_TYPE_TEXTAREA' => $_ARRAYLANG['TXT_IMMO_TYPE_TEXTAREA'], 'TXT_IMMO_TYPE_IMG' => $_ARRAYLANG['TXT_IMMO_TYPE_IMG'], 'TXT_IMMO_CLONEROW' => $_ARRAYLANG['TXT_IMMO_CLONEROW'], 'TXT_IMMO_DELETE' => $_ARRAYLANG['TXT_IMMO_DELETE'], 'TXT_IMMO_DELETEROW' => $_ARRAYLANG['TXT_IMMO_DELETEROW'], 'TXT_IMMO_DEFINE_FIELDS' => $_ARRAYLANG['TXT_IMMO_DEFINE_FIELDS'], 'TXT_IMMO_LANGUAGES' => $_ARRAYLANG['TXT_IMMO_LANGUAGES'], 'TXT_IMMO_IMAGES' => $_ARRAYLANG['TXT_IMMO_IMAGES'], 'TXT_IMMO_DELETE_UNUSED_IMAGES' => $_ARRAYLANG['TXT_IMMO_DELETE_UNUSED_IMAGES'], 'TXT_IMMO_DELETE_IMAGES' => $_ARRAYLANG['TXT_IMMO_DELETE_IMAGES'], 'TXT_IMMO_SAVE' => $_ARRAYLANG['TXT_IMMO_SAVE'], 'TXT_IMMO_AVAILABLE_LANGUAGES' => $_ARRAYLANG['TXT_IMMO_AVAILABLE_LANGUAGES'], 'TXT_IMMO_NEW_LANGUAGE' => $_ARRAYLANG['TXT_IMMO_NEW_LANGUAGE'], 'TXT_IMMO_ADD' => $_ARRAYLANG['TXT_IMMO_ADD'], 'TXT_IMMO_AVAILABLE_FIELDS' => $_ARRAYLANG['TXT_IMMO_AVAILABLE_FIELDS'], 'TXT_IMMO_ID' => $_ARRAYLANG['TXT_IMMO_ID'], 'TXT_IMMO_TYPE' => $_ARRAYLANG['TXT_IMMO_TYPE'], 'TXT_IMMO_FUNCTIONS' => $_ARRAYLANG['TXT_IMMO_FUNCTIONS'], 'TXT_CONFIRM_DELETE' => $_ARRAYLANG['TXT_CONFIRM_DELETE'], 'TXT_IMMO_SHOW_FILE' => $_ARRAYLANG['TXT_IMMO_SHOW_FILE'], 'TXT_IMMO_EDIT' => $_ARRAYLANG['TXT_IMMO_EDIT'], 'TXT_SETTINGS' => $_ARRAYLANG['TXT_SETTINGS'], 'TXT_IMMO_LATEST_ENTRIES_COUNT' => $_ARRAYLANG['TXT_IMMO_LATEST_ENTRIES_COUNT'], 'TXT_IMMO_GOOGLE_KEY' => $_ARRAYLANG['TXT_IMMO_GOOGLE_KEY'], 'TXT_IMMO_SAVE' => $_ARRAYLANG['TXT_IMMO_SAVE'], 'TXT_IMMO_ICON_MESSAGE' => $_ARRAYLANG['TXT_IMMO_ICON_MESSAGE'], 'TXT_IMMO_MAP_STARTPOINT_FRONTEND' => $_ARRAYLANG['TXT_IMMO_MAP_STARTPOINT_FRONTEND'], 'TXT_IMMO_MAP_STARTPOINT_BACKEND' => $_ARRAYLANG['TXT_IMMO_MAP_STARTPOINT_BACKEND'], 'TXT_IMMO_SETTINGS_ICON_MESSAGE_DESC' => $_ARRAYLANG['TXT_IMMO_SETTINGS_ICON_MESSAGE_DESC'], 'IMMO_SETTINGS_DOMAIN1' => $domain1, 'IMMO_SETTINGS_DOMAIN2' => $domain2, 'TXT_IMMO_TYPE_LINK' => $_ARRAYLANG['TXT_IMMO_TYPE_LINK'], 'TXT_IMMO_TYPE_PROTECTED_LINK' => $_ARRAYLANG['TXT_IMMO_TYPE_PROTECTED_LINK'], 'TXT_IMMO_TYPE_PANORAMA' => $_ARRAYLANG['TXT_IMMO_TYPE_PANORAMA'], 'TXT_IMMO_TYPE_DIGITS_ONLY' => $_ARRAYLANG['TXT_IMMO_TYPE_DIGITS_ONLY'], 'TXT_IMMO_TYPE_PRICE' => $_ARRAYLANG['TXT_IMMO_TYPE_PRICE'], 'TXT_IMMO_MANDATORY' => $_ARRAYLANG['TXT_IMMO_MANDATORY'], 'TXT_IMMO_NO' => $_ARRAYLANG['TXT_IMMO_NO'], 'TXT_IMMO_YES' => $_ARRAYLANG['TXT_IMMO_YES'], 'TXT_IMMO_CURRENCY' => $_ARRAYLANG['TXT_IMMO_CURRENCY'], 'TXT_IMMO_PROTECTED_LINK_EMAIL_MESSAGE_BODY' => $_ARRAYLANG['TXT_IMMO_PROTECTED_LINK_EMAIL_MESSAGE_BODY'], 'TXT_IMMO_PROTECTED_LINK_EMAIL_MESSAGE_SUBJECT' => $_ARRAYLANG['TXT_IMMO_PROTECTED_LINK_EMAIL_MESSAGE_SUBJECT'], 'TXT_IMMO_PROTECTED_LINK_SENDER_NAME' => $_ARRAYLANG['TXT_IMMO_PROTECTED_LINK_SENDER_NAME'], 'TXT_IMMO_PROTECTED_LINK_SENDER_EMAIL' => $_ARRAYLANG['TXT_IMMO_PROTECTED_LINK_SENDER_EMAIL'], 'TXT_IMMO_PROTECTED_LINK_EMAIL_MESSAGE_BODY_INFO' => $_ARRAYLANG['TXT_IMMO_PROTECTED_LINK_EMAIL_MESSAGE_BODY_INFO'], 'TXT_IMMO_CONTACT_RECEIVERS' => $_ARRAYLANG['TXT_IMMO_CONTACT_RECEIVERS'], 'TXT_IMMO_CONTACT_RECEIVERS_INFO' => $_ARRAYLANG['TXT_IMMO_CONTACT_RECEIVERS_INFO'], 'TXT_IMMO_INTEREST_CONFIRM_SUBJECT' => $_ARRAYLANG['TXT_IMMO_INTEREST_CONFIRM_SUBJECT'], 'TXT_IMMO_INTEREST_CONFIRM_MESSAGE' => $_ARRAYLANG['TXT_IMMO_INTEREST_CONFIRM_MESSAGE'], 'TXT_IMMO_INTEREST_INFO' => $_ARRAYLANG['TXT_IMMO_INTEREST_INFO'], 'IMMO_SETTINGS_LATEST_ENTRIES_COUNT' => $this->arrSettings['latest_entries_count'], 'IMMO_SETTINGS_GOOGLE_KEY_DOMAIN1' => $this->arrSettings['GOOGLE_API_KEY_' . $domain1], 'IMMO_SETTINGS_GOOGLE_KEY_DOMAIN2' => $this->arrSettings['GOOGLE_API_KEY_' . $domain2], 'IMMO_SETTINGS_ICON_MESSAGE' => htmlspecialchars($this->arrSettings['message']), 'TXT_IMMO_GOOGLE_KEY_INFO' => $_ARRAYLANG['TXT_IMMO_GOOGLE_KEY_INFO'], 'IMMO_LON_FRONTEND' => $this->arrSettings['lon_frontend'], 'IMMO_LAT_FRONTEND' => $this->arrSettings['lat_frontend'], 'IMMO_ZOOM_FRONTEND' => $this->arrSettings['zoom_frontend'], 'IMMO_LON_BACKEND' => $this->arrSettings['lon_backend'], 'IMMO_LAT_BACKEND' => $this->arrSettings['lat_backend'], 'IMMO_ZOOM_BACKEND' => $this->arrSettings['zoom_backend'], 'IMMO_PROT_LINK_MESSAGE_SUBJECT' => $this->arrSettings['prot_link_message_subject'], 'IMMO_PROT_LINK_MESSAGE_BODY' => $this->arrSettings['prot_link_message_body'], 'IMMO_PROT_LINK_SENDER_EMAIL' => $this->arrSettings['sender_email'], 'IMMO_PROT_LINK_SENDER_NAME' => $this->arrSettings['sender_name'], 'IMMO_CONTACT_RECEIVERS' => $this->arrSettings['contact_receiver'], 'IMMO_INTEREST_CONFIRM_SUBJECT' => $this->arrSettings['interest_confirm_subject'], 'IMMO_INTEREST_CONFIRM_MESSAGE' => $this->arrSettings['interest_confirm_message'], 'IMMO_DEFINE_FIELDS_COLSPAN' => $this->langCount + 4, 'IMMO_LANG_COUNT' => $this->langCount, 'IMMO_LANG_COUNT_PLUS1' => $this->langCount + 1));
     $rowid = 2;
     foreach ($this->fieldNames as $fieldID => $field) {
         foreach ($this->languages as $langID => $language) {
             $this->_objTpl->setVariable(array('IMMO_FIELD_CONTENT' => !empty($field['names'][$langID]) ? $field['names'][$langID] : '', 'IMMO_FIELD_LANGID' => $langID));
             $this->_objTpl->touchBlock('langRow4');
             $this->_objTpl->parse('langRow4');
         }
         $this->_objTpl->setVariable(array('IMMO_FIELD_ID' => $fieldID, 'IMMO_FIELD_TYPE' => $_ARRAYLANG['TXT_IMMO_TYPE_' . strtoupper($field['type'])], 'IMMO_FIELD_TYPE_LIST' => $this->_getFieldTypeList($fieldID, $field['type']), 'TXT_MANDATORY' => $field['mandatory'] ? $_ARRAYLANG['TXT_IMMO_YES'] : $_ARRAYLANG['TXT_IMMO_NO'], 'IMMO_ORDER' => $field['order'], 'IMMO_ROW' => $rowid == 2 ? $rowid-- : $rowid++, 'IMMO_SELECTED_' . ($field['mandatory'] ? "YES" : "NO") => "selected=\"selected\""));
         $this->_objTpl->parse('fieldLangList');
     }
     foreach ($this->languages as $id => $lang) {
         $this->_objTpl->setVariable(array('IMMO_LANGUAGE_ID' => $id, 'IMMO_LANGUAGE_NAME' => $_ARRAYLANG[$lang], 'IMMO_LANGUAGE_ID2' => $id, 'IMMO_LANGUAGE_NAME2' => $_ARRAYLANG[$lang], 'IMMO_LANGUAGE_NAME3' => $_ARRAYLANG[$lang], 'IMMO_LANGUAGE_NAME5' => $_ARRAYLANG[$lang], 'IMMO_LANGUAGE_ID5' => $id, 'IMMO_CURRENCY' => $this->arrSettings['currency_lang_' . $id]));
         $this->_objTpl->parse('langRow');
         $this->_objTpl->parse('langRow2');
         $this->_objTpl->parse('langRow3');
         $this->_objTpl->parse('langRow5');
         $this->_objTpl->parse('langRowContent');
     }
 }
 /**
  * Create an episode value object from the contents of an acceptable markdown file
  *
  * @param \SplFileInfo $file
  * @return \PodcastSite\Entity\Episode
  */
 protected function buildEpisode(\SplFileInfo $file)
 {
     $fileContent = file_get_contents($file->getPathname());
     /** @var \Mni\FrontYAML\Document $document */
     $document = $this->fileParser->parse($fileContent);
     return new Episode($document->getYAML()['publish_date'], $document->getYAML()['slug'], $document->getYAML()['title'], $document->getContent(), $document->getYAML()['link'], $document->getYAML()['download']);
 }
Example #7
0
 /**
  * displays the advanced search form body
  *
  * @param bool $header display this with headers
  * @param bool $return echo or return the html
  *
  * @return string html of contents
  */
 function displayAdvanced($header = true, $return = false, $listViewDefs = '', $lv = '')
 {
     global $current_user, $current_language;
     $GLOBALS['log']->debug('SearchForm.php->displayAdvanced()');
     $this->bean->custom_fields->populateAllXTPL($this->xtpl, 'search');
     if (!empty($listViewDefs) && !empty($lv)) {
         $GLOBALS['log']->debug('SearchForm.php->displayAdvanced(): showing saved search');
         $savedSearch = BeanFactory::getBean('SavedSearch');
         $savedSearch->init($listViewDefs[$this->module], $lv->data['pageData']['ordering']['orderBy'], $lv->data['pageData']['ordering']['sortOrder']);
         $this->xtpl->assign('SAVED_SEARCH', $savedSearch->getForm($this->module, false));
         $this->xtpl->assign('MOD_SAVEDSEARCH', return_module_language($current_language, 'SavedSearch'));
         $this->xtpl->assign('ADVANCED_SEARCH_IMG', SugarThemeRegistry::current()->getImageURL('advanced_search.gif'));
         //this determines whether the saved search subform should be rendered open or not
         if (isset($_REQUEST['showSSDIV']) && $_REQUEST['showSSDIV'] == 'yes') {
             $this->xtpl->assign('SHOWSSDIV', 'yes');
             $this->xtpl->assign('DISPLAYSS', '');
         } else {
             $this->xtpl->assign('SHOWSSDIV', 'no');
             $this->xtpl->assign('DISPLAYSS', 'display:none');
         }
     }
     $this->xtpl->parse("advanced");
     $text = $this->xtpl->text("advanced");
     if ($header) {
         $this->displayWithHeaders('advanced_search', '', $text);
     } else {
         if ($return) {
             return $text;
         } else {
             echo $text;
         }
     }
 }
 /**
  * Return a list of tags
  *
  * Called through ajax
  */
 private function getTags()
 {
     $lang = isset($_GET['lang']) ? $_GET['lang'] : 1;
     try {
         if ($_GET['sort'] == "popularity") {
             $tags = $this->tags->getAllOrderByPopularity($lang);
         } else {
             $tags = $this->tags->getAllOrderAlphabetically($lang);
         }
     } catch (DatabaseError $e) {
         // TODO
         // this is not handled anyhow (and not only here)
         $this->sendAjaxError($e->formatted());
     }
     $this->tpl->loadTemplateFile('module_knowledge_articles_edit_taglist.html');
     $this->tpl->setGlobalVariable("MODULE_INDEX", MODULE_INDEX);
     $return_tags = array();
     $classnumber = 1;
     foreach ($tags as $tag) {
         $this->tpl->setVariable(array("TAG" => $tag['name'], "TAGID" => $tag['id'], "CLASSNUMBER" => ++$classnumber % 2 + 1, "LANG" => $lang));
         $this->tpl->parse("tag");
         $return_tags[$tag['id']] = $tag['name'];
     }
     $this->tpl->parse("taglist");
     $taglist = $this->tpl->get("taglist");
     \Env::get('ClassLoader')->loadFile(ASCMS_LIBRARY_PATH . '/PEAR/Services/JSON.php');
     $objJson = new \Services_JSON();
     $jsonResponse = $objJson->encode(array("html" => $taglist, "available_tags" => $return_tags));
     die($jsonResponse);
 }
Example #9
0
 protected static function parseBbcode($str, $special_code, $strip = true)
 {
     if (static::$_bbcode_parser === null) {
         $bbcode = new \StringParser_BBCode();
         // add list of bbcode for formatting
         $codes = [];
         $codes[] = ['code', 'simple_replace', null, ['start_tag' => '<code>', 'end_tag' => '</code>'], 'code', ['block', 'inline'], []];
         $codes[] = ['spoiler', 'simple_replace', null, ['start_tag' => '<span class="spoiler">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']];
         $codes[] = ['sub', 'simple_replace', null, ['start_tag' => '<sub>', 'end_tag' => '</sub>'], 'inline', ['block', 'inline'], ['code']];
         $codes[] = ['sup', 'simple_replace', null, ['start_tag' => '<sup>', 'end_tag' => '</sup>'], 'inline', ['block', 'inline'], ['code']];
         $codes[] = ['b', 'simple_replace', null, ['start_tag' => '<b>', 'end_tag' => '</b>'], 'inline', ['block', 'inline'], ['code']];
         $codes[] = ['i', 'simple_replace', null, ['start_tag' => '<em>', 'end_tag' => '</em>'], 'inline', ['block', 'inline'], ['code']];
         $codes[] = ['m', 'simple_replace', null, ['start_tag' => '<tt class="code">', 'end_tag' => '</tt>'], 'inline', ['block', 'inline'], ['code']];
         $codes[] = ['o', 'simple_replace', null, ['start_tag' => '<span class="overline">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']];
         $codes[] = ['s', 'simple_replace', null, ['start_tag' => '<span class="strikethrough">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']];
         $codes[] = ['u', 'simple_replace', null, ['start_tag' => '<span class="underline">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']];
         $codes[] = ['EXPERT', 'simple_replace', null, ['start_tag' => '<span class="expert">', 'end_tag' => '</span>'], 'inline', ['block', 'inline'], ['code']];
         foreach ($codes as $code) {
             if ($strip) {
                 $code[1] = 'callback_replace';
                 $code[2] = '\\Comment::stripUnusedBbcode';
                 // this also fixes pre/code
             }
             $bbcode->addCode($code[0], $code[1], $code[2], $code[3], $code[4], $code[5], $code[6]);
         }
         static::$_bbcode_parser = $bbcode;
     }
     // if $special == true, add special bbcode
     if ($special_code === true) {
         static::$_bbcode_parser->addCode('moot', 'simple_replace', null, ['start_tag' => '', 'end_tag' => ''], 'inline', ['block', 'inline'], []);
         static::$_bbcode_parser->addCode('fortune', 'usecontent?', '\\Comment::parseBbcodeAttr', ['usecontent_param' => 'color'], 'inline', ['block', 'inline'], []);
     }
     return static::$_bbcode_parser->parse($str);
 }
Example #10
0
 /**
  * Tests the parse() method.
  *
  * @covers  \Hubzero\Config\Processor\Ini::parse
  * @return  void
  **/
 public function testParse()
 {
     $result = $this->processor->parse(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Files' . DIRECTORY_SEPARATOR . 'test.ini');
     $this->assertEquals($this->arr, $result);
     $this->setExpectedException('Hubzero\\Config\\Exception\\ParseException');
     $result = $this->processor->parse(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'Files' . DIRECTORY_SEPARATOR . 'test.xml');
 }
Example #11
0
 /**
  * parse the file list
  *
  * @access private
  */
 private function getFileList()
 {
     global $_ARRAYLANG;
     $this->objUrl->setParam("uploadId", false);
     $this->objTemplate->setVariable(array("NEW_UPLOAD" => $_ARRAYLANG["TXT_FILESHARING_NEW_UPLOAD"], "NEW_UPLOAD_HREF" => $this->objUrl));
     foreach ($this->files as $file) {
         // set the lang variables
         $this->objTemplate->setVariable(array("FILESHARING_FILE_NAME" => $_ARRAYLANG["TXT_FILESHARING_FILE_NAME"], "FILESHARING_DOWNLOAD_LINK" => $_ARRAYLANG["TXT_FILESHARING_DOWNLOAD_LINK"], "FILESHARING_DELETE_LINK" => $_ARRAYLANG["TXT_FILESHARING_DELETE_LINK"]));
         // set the file variables
         $this->objTemplate->setVariable(array("FILE_NAME" => $file["name"], "FILE_IMAGE_SRC" => $file["image"], "FILE_DOWNLOAD_LINK_HREF" => $file["download"], "FILE_DELETE_LINK_HREF" => $file["delete"]));
         if ($file["image"] === false) {
             if ($this->objTemplate->blockExists('image')) {
                 $this->objTemplate->hideBlock("image");
             }
         }
         if ($this->objTemplate->blockExists('filesharing_file')) {
             $this->objTemplate->parse("filesharing_file");
         }
     }
     if ($this->objTemplate->blockExists('uploaded')) {
         $this->objTemplate->touchBlock("uploaded");
     }
     if ($this->objTemplate->blockExists('upload_form')) {
         $this->objTemplate->hideBlock("upload_form");
     }
     if ($this->objTemplate->blockExists('confirm_delete')) {
         $this->objTemplate->hideBlock('confirm_delete');
     }
 }
Example #12
0
 /**
  * Show archive
  *
  * Show the livecam archive from a specified date
  *
  * @access private
  * @param string $date
  */
 function _showArchive($date)
 {
     global $_ARRAYLANG;
     \JS::activate("shadowbox", array('players' => array('img')));
     \JS::activate('jqueryui');
     \JS::registerCode("\n            cx.ready(function() {\n                cx.jQuery('input[name=date]').datepicker({dateFormat: 'yy-mm-dd'});\n            });\n        ");
     $this->camSettings = $this->getCamSettings($this->cam);
     $this->_getThumbs();
     if (count($this->_arrArchiveThumbs) > 0) {
         $countPerRow;
         $picNr = 1;
         usort($this->_arrArchiveThumbs, array($this, '_sort_thumbs'));
         foreach ($this->_arrArchiveThumbs as $arrThumbnail) {
             if (!isset($countPerRow)) {
                 if (!$this->_objTpl->blockExists($this->_pictureTemplatePlaceholder . $picNr)) {
                     $this->_objTpl->parse('livecamArchiveRow');
                     $countPerRow = $picNr - 1;
                     $picNr = 1;
                 }
             }
             $this->_objTpl->setVariable(array('LIVECAM_PICTURE_URL' => $arrThumbnail['link_url'], 'LIVECAM_PICTURE_TIME' => $arrThumbnail['time'], 'LIVECAM_THUMBNAIL_URL' => $arrThumbnail['image_url'], 'LIVECAM_THUMBNAIL_SIZE' => $this->camSettings['thumbMaxSize'], 'LIVECAM_IMAGE_SHADOWBOX' => $this->camSettings['shadowboxActivate'] == 1 ? 'shadowbox[gallery]' : ''));
             $this->_objTpl->parse($this->_pictureTemplatePlaceholder . $picNr);
             if (isset($countPerRow) && $picNr == $countPerRow) {
                 $picNr = 0;
                 $this->_objTpl->parse('livecamArchiveRow');
             }
             $picNr++;
         }
         $this->_objTpl->parse('livecamArchive');
     } else {
         $this->statusMessage = $_ARRAYLANG['TXT_LIVECAM_NO_PICTURES_OF_SELECTED_DAY'];
     }
 }
Example #13
0
 /**
  * 
  *
  */
 function testTouchBlockIteration()
 {
     $data = array('a', 'b', 'c', 'd', 'e');
     $result = $this->tpl->loadTemplateFile('blockiteration.html', true, true);
     if (PEAR::isError($result)) {
         $this->assertTrue(false, 'Error loading template file: ' . $result->getMessage());
     }
     for ($i = 0; $i < count($data); $i++) {
         $this->tpl->setVariable('outer', $data[$i]);
         // the inner_block is empty and should be removed
         if (0 == $i % 2) {
             $this->tpl->touchBlock('inner_block');
         }
         $this->tpl->parse('outer_block');
     }
     $this->assertEquals('a|#b#c|#d#e|#', $this->_stripWhitespace($this->tpl->get()));
 }
Example #14
0
 /**
  * testParse
  *
  * @since 3.0.0
  *
  * @param string $dbUrl
  * @param array $configArray
  *
  * @dataProvider providerParse
  */
 public function testParse($dbUrl = null, $configArray = [])
 {
     /* setup */
     $this->_config->init(Stream::url('root/config.php'));
     $this->_config->parse($dbUrl);
     /* actual */
     $actual = $this->_config->get();
     /* compare */
     $this->assertEquals($configArray, $actual);
 }
Example #15
0
 /**
  * Parse the language options for the placeholder settings
  *
  * @param array $arrActiveSystemFrontendLanguages
  * @param string $placeholder the placeholder
  */
 private function parseLanguageOptionsByPlaceholder($arrActiveSystemFrontendLanguages, $placeholder)
 {
     foreach ($arrActiveSystemFrontendLanguages as $langId => $arrLanguage) {
         $checked = '';
         if ($langId == FRONTEND_LANG_ID) {
             $checked = 'checked="checked"';
         }
         $this->_objTpl->setVariable(array('BLOCK_PAGES_LANGUAGE_ID' => $langId, 'BLOCK_PAGES_LANGUAGE_CODE' => $arrLanguage['lang'], 'BLOCK_PAGES_LANGUAGE_NAME' => $arrLanguage['name'], 'BLOCK_PAGES_LANGUAGE_CHECKED' => $checked));
         $this->_objTpl->parse('pages_languages_' . $placeholder);
     }
 }
Example #16
0
 function listOverview()
 {
     global $_CORELANG, $_ARRAYLANG, $objDatabase;
     $this->_pageTitle = $_ARRAYLANG['TXT_SURVEYOVERVIEW'];
     $this->_objTpl->loadTemplateFile('module_list_overview.html');
     // Parsing javascript function to the place holder.
     $this->_objTpl->setVariable(array('SHOW_SURVEY_JAVASCRIPT' => $this->getCreateAddressJavascript()));
     /* Start Paging ------------------------------------ */
     /*	$intPos             = (isset($_GET['pos'])) ? intval($_GET['pos']) : 0;
     		// TODO: Never used
     	        $intPerPage         = $this->getPagingLimit();
             
             	$strPagingSource    = getPaging($this->countEntries('survey_surveygroup'), $intPos, '&amp;section=Survey&amp;cmd=activesurveys', false, $intPerPage);        
             	$this->_objTpl->setVariable('ENTRIES_PAGING', $strPagingSource);
     		$limit = $this->getPagingLimit();                 //how many items to show per page
     		$page = $_REQUEST['pos'];
     		if($page){ 
     		$start = $page; 			//first item to display on this page
     	        }else{
     			$start = 0;				//if no page var is given, set start to 0
     		}	*/
     /* End Paging -------------------------------------- */
     $objResult = $objDatabase->Execute('SELECT  * FROM ' . DBPREFIX . 'module_survey_addresslist ORDER BY id desc');
     $row = 'row1';
     $this->_objTpl->setVariable(array('TXT_ADDRESS_LIST_OVERVIEW' => $_ARRAYLANG['TXT_ADDRESS_LIST_OVERVIEW'], 'TXT_SYMBOL' => $_ARRAYLANG['TXT_SYMBOL'], 'TXT_STATUS' => $_ARRAYLANG['TXT_STATUS'], 'TXT_SURVEY_TITLE' => $_ARRAYLANG['TXT_SURVEY_TITLE'], 'TXT_CREATED_AT' => $_ARRAYLANG['TXT_CREATED_AT'], 'TXT_MODIFIED_AT' => $_ARRAYLANG['TXT_MODIFIED_AT'], 'TXT_COUNTER' => $_ARRAYLANG['TXT_COUNTER'], 'TXT_FUNCTIONS' => $_ARRAYLANG['TXT_FUNCTIONS'], 'TXT_SELECT_ALL' => $_ARRAYLANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_ARRAYLANG['TXT_DESELECT_ALL'], 'TXT_DESCRIPTION' => $_ARRAYLANG['TXT_DESCRIPTION'], 'TXT_SELECT_ACTION' => $_ARRAYLANG['TXT_SELECT_ACTION'], 'TXT_ACTIVATE' => $_ARRAYLANG['TXT_ACTIVATE'], 'TXT_DEACTIVATE' => $_ARRAYLANG['TXT_DEACTIVATE'], 'TXT_DELETE_SELECTED' => $_ARRAYLANG['TXT_DELETE_SELECTED']));
     while (!$objResult->EOF) {
         /*     if($objResult->fields['isActive'] == "1") {
                    $activeImage = "../core/Core/View/Media/icons/led_green.gif";
                    $activeTitle = $_ARRAYLANG['TXT_ACTIVE'] ;
                }
                else {
                    $activeImage = "../core/Core/View/Media/icons/led_red.gif";
                    $activeTitle = $_ARRAYLANG['TXT_INACTIVE'] ;
                }  */
         $list_id = $objResult->fields['id'];
         $objResultcount = $objDatabase->Execute('SELECT  * FROM ' . DBPREFIX . 'module_survey_addressbook WHERE listid=' . $list_id . ' ORDER BY id desc');
         $Addresscount = $objResultcount->RecordCount();
         // for survey Title with tool tip
         $listnameVar = htmlspecialchars($objResult->fields['listname'], ENT_QUOTES);
         $listnameShot = substr($listnameVar, 0, 20);
         if (strlen($listnameVar) > 20) {
             if ($listnameVar != "") {
                 $listTemp = $listnameShot . '..<a href="#" title="' . htmlspecialchars($listnameVar) . '" class="tooltip"><img border="0" src="' . ASCMS_PATH_OFFSET . ASCMS_MODULE_FOLDER . '/Survey/View/Media/comment.gif"><a>';
             }
         } else {
             if ($listnameVar != "") {
                 $listTemp = $listnameShot;
             }
         }
         $this->_objTpl->setVariable(array('TXT_LIST_ID' => $objResult->fields['id'], 'TXT_LIST_TITLE_LABEL' => $listTemp, 'TXT_LIST_CREATED_AT' => $objResult->fields['created'], 'TXT_LIST_UPDATED_AT' => $objResult->fields['updated'], 'TXT_LIST_COUNTER' => $Addresscount, 'ENTRY_ROWCLASS' => $row = $row == 'row1' ? 'row2' : 'row1'));
         $this->_objTpl->parse('showEntries');
         $objResult->MoveNext();
     }
 }
 function testClearVariables()
 {
     if (!$this->_methodExists('clearVariables')) {
         return;
     }
     $this->tpl->setTemplate('<!-- BEGIN block -->{var_1}:<!-- END block -->{var_2}', true, true);
     $this->tpl->setVariable(array('var_1' => 'a', 'var_2' => 'b'));
     $this->tpl->parse('block');
     $this->tpl->clearVariables();
     $this->assertEquals('a:', $this->_stripWhitespace($this->tpl->get()));
 }
Example #18
0
 /**
  * Function fnProcessRight to Process Right panel for Global Template file
  * @access public 
  * @param object $hdlTpl
  *  	
  */
 function fnProcessRight($hdlTpl)
 {
     //PROCESS CONTENT FROM RIGHT COLUMN
     $hdlRTpl = clsUtil::fnTemplateClass($this->strModule);
     $hdlRTpl->loadTemplateFile("_right.tpl.html", 1, 1);
     $hdlRTpl->setVariable("test_variable", "right");
     $strRightContent = $hdlRTpl->get();
     //PRINT RIGHT COLUM HTNL CONTENT ON THE GLOBAL TPL
     $hdlTpl->touchBlock("RIGHT_COLUMN");
     $hdlTpl->setVariable("RIGHT", $strRightContent);
     $hdlTpl->parse("RIGHT_COLUMN");
 }
Example #19
0
 /**
  * Parse a given fragment and fix up Tidy's trail of blood on
  * it...
  *
  * @param string $in The text to parse
  * @return string The parsed text
  */
 function parse($in)
 {
     if (method_exists($this->mParser, 'recursiveTagParse')) {
         // New fast method
         return $this->mParser->recursiveTagParse($in);
     } else {
         // Old method
         $ret = $this->mParser->parse($in, $this->mParser->mTitle, $this->mParser->mOptions, false, false);
         $text = $ret->getText();
         return $this->fixTidy($text);
     }
 }
Example #20
0
	/**
	 * Optimise Output String
	 * 
	 * Takes either a CSS or JS string and compacts it using
	 * external plugins CSSTidy/Packer.
	 * 
	 * @access private
	 * @return string
	 * @param string $string String to compact
	 * @param string $type Type, either 'css' or 'js'
	 */
	function _optimise_output($string, $type)
	{
		switch($type)
		{
			case 'css':
				// Do we have a CSS Tidy plugin
				$csstidy_options = $this->CI->config->item('csstidy','bep_assets');

				if($csstidy_options['path'] != "" && file_exists($csstidy_options['path']))
				{
					// Do we need to load the plugin
					if($this->csstidy == null)
					{
						include_once($csstidy_options['path']);
						
						$this->csstidy = new CSSTidy();
						
						//load template and configure
			            $this->csstidy->load_template($csstidy_options['template']);
			            foreach ($csstidy_options['config'] as $key => $val)
						{
			                $this->csstidy->set_cfg($key, $val);
			            }
					}				
					
					// Parse the text
					$this->csstidy->parse($string);
					$string = $this->csstidy->print->plain();
				}
				break;
				
			case 'js':
				// Do we have a JS packer
				$packer_options = $this->CI->config->item('packer','bep_assets');

				if($packer_options['path'] != "" && file_exists($packer_options['path']))
				{
					// Do we need to load the plugin
					if($this->packer == null)
					{
						include_once($packer_options['path']);					
					}				
					
					// Parse the text
					$this->packer = new JavaScriptPacker($string);
					$string = $this->packer->pack();
				}
				break;
		}
		
		return $string;
	}
Example #21
0
 /**
  * Returns the block's contents
  *
  * The method is needed because ITX and Sigma implement clearing
  * the block contents on get() a bit differently
  *
  * @param    string  Block name
  * @return   string  Block contents
  */
 function _getTplBlock($block)
 {
     $this->_tpl->parse($block);
     if (is_a($this->_tpl, 'html_template_sigma')) {
         $ret = $this->_tpl->get($block, true);
     } else {
         $oldClear = $this->_tpl->clearCache;
         $this->_tpl->clearCache = true;
         $ret = $this->_tpl->get($block);
         $this->_tpl->clearCache = $oldClear;
     }
     return $ret;
 }
 /**
  * Parses feed using vendors own parse method
  * @param  string $contents
  * @return bool
  */
 private function parse($contents)
 {
     // $reader = new XML\Reader;
     // $reader->xml($contents);
     // $output = $reader->parse();
     // $objects = $this->vendor->parse($output);
     $objects = $this->vendor->parse(new \SimpleXMLElement($contents));
     if ($objects) {
         $this->objects = $objects;
         return true;
     }
     return false;
 }
 /**
  * ?
  *
  * @param $sn ?
  * @param $start ?
  * @param $total ?
  * @param $extra ?
  * @param $twidth ?
  * @param $bgtheme ?
  * @param $search_obj ?
  * @param $filter_obj ?
  * @param $showsearch ?
  */
 function show_tpl($sn, $localstart, $total, $extra, $twidth, $bgtheme, $search_obj = 0, $filter_obj = 1, $showsearch = 1, $yours = 0, $cat_id = 0, $cat_field = 'fcat_id')
 {
     list($filter, $qfield, $start, $order, $sort, $query) = $this->_get_var();
     $start = $localstart;
     $cats = createObject('phpgwapi.categories');
     $extravars = array();
     $extravars = $this->split_extras($extravars, $extra);
     $var = array('form_action' => $this->action ? $this->page($extra) : $GLOBALS['phpgw']->link($sn, $extra), 'lang_category' => lang('Category'), 'lang_all' => lang('All'), 'lang_select' => lang('Select'), 'cat_field' => $cat_field, 'categories' => $cats->formated_list('select', 'all', $cat_id, 'True'), 'filter_value' => $filter, 'qfield' => $qfield, 'start_value' => $start, 'order_value' => $order, 'sort_value' => $sort, 'query_value' => $query, 'table_width' => $twidth, 'left' => $this->left($sn, $start, $total, $extra), 'search' => $showsearch ? $this->search($search_obj) : '', 'filter' => $filter_obj ? $this->filter($filter_obj, $yours) : '', 'right' => $this->right($sn, $start, $total, $extra));
     $this->template->set_var($var);
     $this->template->parse('cats', 'nm_cats');
     $this->template->parse('cats_search_filter_data', 'nm_cats_search_filter');
     return $this->template->fp('out', 'nextmatchs');
 }
 /**
  * Test the parse() function
  *
  * @return  void
  */
 public function testParse()
 {
     // Setup
     $content = 'content';
     // Test a complete complex case (bad semantics practice, avoid in production!)
     $html = "<tag data-sd='articleBody Article Event.sameAs Person.award Article.url Person name'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemprop='url'>{$content}</tag>");
     // Test it displays the scope and set the current Type, tag parse: data-*="Article"
     $html = "<tag data-sd='Article'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemscope itemtype='https://schema.org/Article'>{$content}</tag>");
     // Test a 'specialized' fallback, tag parse: data-*="Article.author"
     $html = "<tag data-sd='Article.author'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemprop='author'>{$content}</tag>");
     // Test a 'specialized' fallback with an expected Type, tag parse: data-*="Article.author.Person"
     $html = "<tag data-sd='Article.author.Person'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemprop='author' itemscope itemtype='https://schema.org/Person'>{$content}</tag>");
     // Test a 'global' property, tag parse: data-*="author"
     $html = "<tag data-sd='Article author'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemprop='author'>{$content}</tag>");
     // Test a 'global' property with an expected Type, tag parse: data-*="author"
     $html = "<tag data-sd='author.Person'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemprop='author' itemscope itemtype='https://schema.org/Person'>{$content}</tag>");
     // Test a strange behaviour, should set the current Type and display the scope with the last match, tag parse: data-*="Article Person"
     $html = "<tag data-sd='Article Person'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemscope itemtype='https://schema.org/Article'>{$content}</tag>");
     // Test it displays the 'specialized' fallback instead of the 'global' fallback, tag parse: data-*="Article.articleBody description"
     $html = "<tag data-sd='Article.articleBody description'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemprop='articleBody'>{$content}</tag>");
     // Test check the 'global' fallbacks order, tag parse: data-*="description articleBody"
     $html = "<tag data-sd='description articleBody'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemprop='description'>{$content}</tag>");
     // Test self-closing tag parse: data-*="datePublished"
     $html = "<meta data-sd='Article datePublished' content='2014-01-01T00:00:00+00:00' />";
     $this->assertEquals($this->handler->parse($html), "<meta itemprop='datePublished' content='2014-01-01T00:00:00+00:00' />");
     // Test tag parse: data-*="Article.propertyDoesNotExist"
     $html = "<tag data-sd='Article.propertyDoesNotExist'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag >{$content}</tag>");
     // Test tag parse: data-*="TypeDoesNotExist.propertyDoesNotExist"
     $html = "<tag data-sd='TypeDoesNotExist.propertyDoesNotExist'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag >{$content}</tag>");
     // Test multiple suffix tag parse
     $this->handler->suffix('custom');
     $html = "<tag data-custom='Article.author'>{$content}</tag><tag data-sd='url'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemprop='author'>{$content}</tag><tag itemprop='url'>{$content}</tag>");
     // Test multiple suffix tag parse, check that replaces only the first match
     $html = "<tag data-sd='Article.author' data-custom='Article.name'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag itemprop='author' data-custom='Article.name'>{$content}</tag>");
     // Test that it doesn't parse an unregistered suffix
     $html = "<tag data-unregistered='Article.author'>{$content}</tag>";
     $this->assertEquals($this->handler->parse($html), "<tag data-unregistered='Article.author'>{$content}</tag>");
 }
Example #25
0
 /**
  * Show the crumbtrail path
  *
  * @global $_LANGID
  * @global $_ARRAYLANG
  * @param int $id
  */
 private function showCrumbtrail($id)
 {
     global $_LANGID, $_ARRAYLANG;
     $this->tpl->setVariable(array("TXT_START" => $_ARRAYLANG['TXT_START']));
     /**
      * Crumbtrail
      */
     $catPath = $this->getCatPath($id);
     foreach ($catPath as $pathElem) {
         $this->tpl->setVariable(array("CRUMB" => $this->categories->categories[$pathElem]['content'][$_LANGID]['name'], "ID" => $pathElem));
         $this->tpl->parse("crumb");
     }
     $this->tpl->parse("crumbtrail");
 }
 /**
  * displays the advanced search form body 
  * 
  * @param bool $header display this with headers
  * @param bool $return echo or return the html
  * 
  * @return string html of contents 
  */
 function displayAdvanced($header = true, $return = false)
 {
     global $current_user, $image_path;
     $this->bean->custom_fields->populateXTPL($this->xtpl, 'search');
     $this->xtpl->parse("advanced");
     $text = $this->xtpl->text("advanced");
     if ($header) {
         $this->displayWithHeaders('advanced_search', '', $text);
     } else {
         if ($return) {
             return $text;
         } else {
             echo $text;
         }
     }
 }
Example #27
0
 /**
  * Load the config.
  *
  * @param string $argv The command line string.
  */
 public function loadConfig($argv = [])
 {
     $args = new Args();
     $args->argument('config', ['default' => 'kahlan-config.php']);
     $args->argument('help', ['type' => 'boolean']);
     $args->argument('version', ['type' => 'boolean']);
     $args->parse($argv);
     if (file_exists($args->get('config'))) {
         require $args->get('config');
     }
     $this->_args->parse($argv, false);
     if ($args->get('help')) {
         return $this->_help();
     }
     if ($args->get('version')) {
         return $this->_version();
     }
 }
 /**
  *
  */
 function testHideBlockIteration()
 {
     if (!$this->_methodExists('hideBlock')) {
         return;
     }
     $data = array('a', 'b', 'c', 'd', 'e');
     $result = $this->tpl->loadTemplateFile('blockiteration.html', true, true);
     if (PEAR::isError($result)) {
         $this->assertTrue(false, 'Error loading template file: ' . $result->getMessage());
     }
     for ($i = 0; $i < count($data); $i++) {
         $this->tpl->setVariable(array('inner' => $i + 1, 'outer' => $data[$i]));
         // the inner_block is not empty, but should be removed
         if (0 == $i % 2) {
             $this->tpl->hideBlock('inner_block');
         }
         $this->tpl->parse('outer_block');
     }
     $this->assertEquals('a#b|2#c#d|4#e#', $this->_stripWhitespace($this->tpl->get()));
 }
 /**
  * This does something - ask ceb and jengo what - they wrote it
  *
  * @return void
  */
 public function list_apps()
 {
     $this->_common_header();
     $GLOBALS['phpgw']->hooks->process('acl_manager', array('preferences'));
     $this->_template->set_file('app_list', 'acl_applist.tpl');
     $this->_template->set_block('app_list', 'list');
     $this->_template->set_block('app_list', 'app_row');
     $this->_template->set_block('app_list', 'app_row_noicon');
     $this->_template->set_block('app_list', 'link_row');
     $this->_template->set_block('app_list', 'spacer_row');
     $this->_template->set_var('lang_header', lang('ACL Manager'));
     while (is_array($GLOBALS['acl_manager']) && (list($app, $locations) = each($GLOBALS['acl_manager']))) {
         $icon = $GLOBALS['phpgw']->common->image($app, array('navbar.gif', $app . '.gif'));
         $this->_template->set_var('icon_backcolor', $GLOBALS['phpgw_info']['theme']['row_off']);
         $this->_template->set_var('link_backcolor', $GLOBALS['phpgw_info']['theme']['row_off']);
         $this->_template->set_var('app_name', lang($GLOBALS['phpgw_info']['navbar'][$app]['title']));
         $this->_template->set_var('a_name', $appname);
         $this->_template->set_var('app_icon', $icon);
         if ($icon) {
             $this->_template->fp('rows', 'app_row', true);
         } else {
             $this->_template->fp('rows', 'app_row_noicon', true);
         }
         while (is_array($locations) && (list($loc, $value) = each($locations))) {
             $total_rights = 0;
             while (list($k, $v) = each($value['rights'])) {
                 $total_rights += $v;
             }
             reset($value['rights']);
             // If all of there rights are denied, then they shouldn't even see the option
             if ($total_rights != $GLOBALS['phpgw']->acl->get_rights($loc, $app)) {
                 $link_values = array('menuaction' => 'admin.uiaclmanager.access_form', 'location' => $loc, 'acl_app' => $app, 'account_id' => $GLOBALS['account_id']);
                 $this->_template->set_var('link_location', $GLOBALS['phpgw']->link('/index.php', $link_values));
                 $this->_template->set_var('lang_location', lang($value['name']));
                 $this->_template->fp('rows', 'link_row', true);
             }
         }
         $this->_template->parse('rows', 'spacer_row', true);
     }
     $this->_template->pfp('out', 'list');
 }
Example #30
0
 /**
  * Load the config.
  *
  * @param string $argv The command line string.
  */
 public function loadConfig($argv = [])
 {
     $commandLine = new CommandLine();
     $commandLine->option('config', ['default' => 'kahlan-config.php']);
     $commandLine->option('help', ['type' => 'boolean']);
     $commandLine->option('version', ['type' => 'boolean']);
     $commandLine->parse($argv);
     $run = function ($commandLine) {
         if (file_exists($commandLine->get('config'))) {
             require $commandLine->get('config');
         }
     };
     $run($commandLine);
     $this->_commandLine->parse($argv, false);
     if ($commandLine->get('help')) {
         return $this->_help();
     }
     if ($commandLine->get('version')) {
         return $this->_version();
     }
 }