public function testSimple() { $input = 'div>span>a'; $prepared = "\n\t<div>\n\t\t<span>\n\t\t\t<a></a>\n\t\t</span>\n\t</div>"; $dom = ar('html')->zen($input); $this->assertInstanceOf('ar_html_zen', $dom); $this->assertEquals($prepared, (string) $dom); }
function _init($config) { if (!$config['publicKey']) { return ar('error')->raiseError('mod_recaptcha: no publicKey given', 404); } if (!$config['privateKey']) { return ar('error')->raiseError('mod_recaptcha: no privateKey given', 404); } return new pinp_recaptcha($config['publicKey'], $config['privateKey'], $config['useSSL']); }
function foo() { $x = ar(); echo $x != true; echo "\n"; echo $x == true; echo "\n"; echo $x != false; echo "\n"; echo $x == false; echo "\n"; }
} if ($arNewType) { echo "<legend>" . $ARnls['ariadne:new:create_object'] . "</legend>"; $typeslist = array($arNewType => $typeslist[$arNewType]); $fields = array("arNewType" => array("type" => "radio", "value" => $arNewType, "options" => $typeslist, "label" => false, "class" => "type_selected")); } else { echo '<legend>' . $ARnls['ariadne:new:select_type'] . '</legend>'; if ($this->CheckSilent("layout")) { $fields = array("showall" => array("type" => "checkbox", "value" => $showall, "label" => $ARnls['ariadne:new:show_all_types'], "checkedValue" => 1, "uncheckedValue" => 0)); $snippit = ar('html')->form($fields, false)->getHTML()->childNodes; foreach ($snippit->getElementsByTagName("input") as $checkOption) { $checkOption->setAttribute("onclick", "this.form.submit();"); } echo $snippit; } $fields = array("arNewType" => array("type" => "radio", "value" => $arNewType, "options" => $typeslist, "label" => false, "class" => "type")); } $snippit = ar('html')->form($fields, false)->getHTML()->childNodes; foreach ($snippit->getElementsByTagName("input") as $radioOption) { $radioOption->setAttribute("onclick", "this.form.submit();"); } foreach ($snippit->getElementsByTagName("label") as $radioLabel) { $radioLabel->setAttribute("onclick", "var f=this.form; document.getElementById(this.getAttribute('for')).checked=true; f.submit();"); } echo $snippit; if ($arNewType) { echo '<input tabindex="-1" style="position: absolute; left: -1000px; width: 0px; height: 0px;" unselectable="on" type="submit" name="wgWizControl" class="wgWizControl" value="current">'; echo '<button class="othertype" type="submit" name="arNewType" value="">' . $ARnls['ariadne:new:change_type'] . '</button>'; } echo '</fieldset>'; }
public function row(array $data, $recursive = true, $extends = array()) { if (Arrays::isAssoc($data)) { $obj = o(sha1(serialize($data))); $obj->db_instance = $this; if (count($extends)) { foreach ($extends as $name => $instance) { $closure = function ($object) use($name, $instance) { $idx = $object->is_thin_object; $objects = Utils::get('thinObjects'); return $instance->{$name}($objects[$idx]); }; $obj->_closures[$name] = $closure; } } $fields = $this->fields(); foreach ($fields as $field) { $hasFk = $this->hasFk($field); if (false === $hasFk) { $obj->{$field} = $data[$field]; } else { extract($hasFk); $ar = ar($foreignEntity, $foreignTable); $one = contain('toone', Inflector::lower($type)); if ($one && $recursive) { $foreignObj = $ar->findBy($foreignKey, $data[$field], $one); $obj->{$relationKey} = $foreignObj; } } } $hasFk = ake('relationships', $this->_settings); if (true === $hasFk && $recursive) { $rs = $this->_settings['relationships']; if (count($rs)) { foreach ($rs as $field => $infos) { extract($infos); $ar = ar($foreignEntity, $foreignTable); if (!Arrays::in($field, $fields)) { $pk = $this->pk(); $obj->{$field} = $ar->findBy($foreignKey, $obj->{$pk}, false, false); } } } } return $obj; } return null; }
$class = 'last'; //$counter = 0; } ?> <div class="thumb <?php echo $class; ?> "> <a href="<?php echo resize($this->config->item('PRODUCT_PATH') . $image['product_image'], 225, 200, 'product_details'); ?> " rel="<?php echo $this->config->item('PRODUCT_URL') . $image['product_image']; ?> " class="thumbnail"><img src="<?php echo ar($this->config->item('PRODUCT_PATH') . $image['product_image'], 60, 52, 'product_thumbnails'); ?> " /></a></div> <?php } ?> <div style="clear:both"></div> </div> <?php } ?> </div> <div id="description"> <h3><span class="noborder"><?php echo ucwords(strtolower($product['product_name']));
public function compile($path, $name) { global $AR; $arpath = path::collapse($path); if (strpos($arpath, $this->path, 0) !== 0) { return ar('error')->raiseError('invalide path for loading template', 500); } $realpath = $this->config['path'] . substr($arpath, strlen($this->path)); $realpath = realpath($realpath) . '/'; $template = file_get_contents($realpath . $name); require_once AriadneBasePath . "/modules/mod_pinp.phtml"; $pinp = new pinp($AR->PINP_Functions, "local->", "\$AR_this->_"); // FIXME error checking $compiled = $pinp->compile(strtr($template, "\r", "")); $compiled = sprintf($AR->PINPtemplate, $compiled); return $compiled; }
<?php if ($module_slideshow && !empty($module_slideshow->details['slides'])) { ?> <?php foreach ($module_slideshow->details['slides'] as $slide) { ?> <?php if ($slide['link'] !== '') { ?> <a href="<?php echo $slide['link']; ?>" <?php if ($slide['new_window'] == 1) { echo ' target="_blank"'; } ?>> <div class="slider"><img src="<?php echo ar($this->config->item('SLIDESHOW_IMAGE_PATH') . $slide['slideshow_image'], 889, 300, 'slidesgow_images'); ?>" alt="<?php echo $slide['alt']; ?>" /></div> </a> <?php } else { ?> <div class="slider"><img src="<?php echo ar($this->config->item('SLIDESHOW_IMAGE_PATH') . $slide['slideshow_image'], 889, 300, 'slidesgow_images'); ?>" alt="<?php echo $slide['alt']; ?>" /></div> <?php } ?> <?php } ?> <?php } ?>
<?php if (isset($module_banner->banner) && $module_banner->banner !== '' && $module_banner->show_banner == 1) { ?> <div id="banner_bg"> <div id="banner"> <?php if (isset($module_banner->banner_url) && $module_banner->banner_url !== '') { ?> <a href="<?php echo $module_banner->banner_url; ?>" <?php if (isset($module_banner->new_window) && $module_banner->new_window == 1) { echo ' target="_blank"'; } ?>> <img src="<?php echo ar($this->config->item('PAGE_DATA_IMAGE_PATH') . $module_banner->banner, 430, 174, 'banner_image'); ?>" /> </a> <?php } else { ?> <img src="<?php echo ar($this->config->item('PAGE_DATA_IMAGE_PATH') . $module_banner->banner, 430, 174, 'banner_image'); ?>" /> <?php } ?> </div> </div> <?php }?>
public function load($url, $meta = "", $maxage = 0, $user = "") { $result = $this->cache->load($url, $maxage, $user); if (!$result && $maxage >= 0) { $client = ar('http')->client(); $data = $client->get($url); if ($data != "") { $result = $this->cache->save($url, $data, $meta, $user); } } return $result; }
public function configure($options) { if ($options['top']) { $this->root(ar('loader')->makeURL($options['top']), $options['top']); } else { $options['top'] = $this->root; } if ($options['current']) { $this->current($options['current']); } else { $options['current'] = $this->current; } $this->options = array_merge($this->options, $options); return $this; }
public function testFTPGetNonExisting() { $content = ar('connect/ftp')->get('ftp://ftp.snt.utwente.nl/pub/test/DOESNTEXIST'); $this->assertInstanceOf('ar_error', $content); }
<?php ldDisablePostProcessing(); $ARCurrent->nolangcheck = true; if ($this->CheckLogin("layout") && $this->CheckConfig()) { set_time_limit(0); $arCallArgs["colorize"] = true; $arCallArgs["nowrap"] = true; $result = $this->find($this->path, '', "system.svn.diff.php", $arCallArgs, 0, 0); $modifications = ""; foreach ($result as $diff) { if (!ar('error')->isError($diff)) { $modifications .= $diff; } } if (!$modifications) { echo "<pre class='svnresult'>" . $ARnls["ariadne:svn:nomod"] . "</pre>"; } else { echo "<pre class='svnresult'>" . $modifications . "</pre>"; } }
require_once AriadneBasePath . "/modules/mod_debug.php"; require_once AriadneBasePath . "/modules/mod_cache.php"; $AR->context = array(); if ($workspace = getenv("ARIADNE_WORKSPACE")) { include_once $store_config['code'] . "modules/mod_workspace.php"; $layer = workspace::getLayer($workspace); if (!$layer) { $layer = 1; } if ($wspaths = getenv("ARIADNE_WORKSPACE_PATHS")) { $wspaths = explode(";", $wspaths); foreach ($wspaths as $wspath) { if ($wspath != '') { $store_config['layer'][$wspath] = $layer; } } } else { $store_config['layer'] = array('/' => $layer); } } require_once AriadneBasePath . "/includes/loader." . $loaderType . ".php"; require_once AriadneBasePath . "/stores/" . $store_config["dbms"] . "store.phtml"; require_once AriadneBasePath . "/modules/mod_session.phtml"; require_once AriadneBasePath . "/modules/mod_auth/" . $auth_config['method'] . ".php"; $prevARnls = $ARnls; $ARnls = ar('nls')->dict($AR->nls->default, null, 'ARnls', AriadneBasePath . '/nls/'); if (is_array($prevARnls)) { foreach ($prevARnls as $key => $value) { $ARnls[$key] = $value; } }
} ?> > <img src="<?php echo ar($this->config->item('SLIDESHOW_IMAGE_PATH') . $slide['slideshow_image'], 745, 330, 'slidesgow_images'); ?> " alt="<?php echo $slide['alt']; ?> " /> </a> <?php } else { ?> <img src="<?php echo ar($this->config->item('SLIDESHOW_IMAGE_PATH') . $slide['slideshow_image'], 745, 330, 'slidesgow_images'); ?> " alt="<?php echo $slide['alt']; ?> " /> <?php } ?> . </div> <?php } ?> </div>
<?php $ARCurrent->nolangcheck = true; if ($this->CheckLogin("layout") && $this->CheckConfig()) { $this->resetloopcheck(); $username = $this->getdata('username'); $password = $this->getdata('password'); $fstore = $this->store->get_filestore_svn("templates"); $svn = $fstore->connect($this->id, $username, $password); $type = $this->getvar("type"); $function = $this->getvar("function"); $language = $this->getvar("language"); if ($type && $function && $language) { $filename = $type . "." . $function . "." . $language . ".pinp"; } $revision = $this->getvar("revision") ? $this->getvar("revision") : ""; $status = $fstore->svn_diff($svn, $filename, $revision); if (ar('error')->isError($status)) { $arResult = $status; } else { if ($colorize) { $status = $this->call("system.svn.diff.colorize.php", array("diff" => $status, "nowrap" => $nowrap)); } $arResult = $status; } }
</div> <div class="field"> <label for="name" class="required"><?php echo $ARnls["url"]; ?> </label> <img class="flag" src="<?php echo $flagurl; ?> " alt="<?php echo $selectedlanguage; ?> "> <?php $snippetDef = array('url' => array('name' => $selectednls . '[urlList]', 'type' => 'fieldlist', 'label' => false, 'class' => 'inputline', 'value' => $urlList)); $formSnippet = ar('html')->parse((string) ar('html')->form($snippetDef, null, null)); $snippet = $formSnippet->getElementsByTagName('fieldset'); echo (string) $snippet; ?> </div> <?php if (getenv("ARIADNE_WORKSPACE") && workspace::enabled($this->path)) { ?> <div class="field"> <label for="name" class="required"><?php echo $ARnls["ariadne:workspace:url"] . ": " . $workspace; ?> </label> <img class="flag" src="<?php echo $flagurl; ?>
protected function getvar($name) { if (preg_match("/(\\w+)\\[(.*?)]/", $name, $matches)) { $arrayvalue = ar::getvar($matches[1]); $value = $this->getArrayValue(substr($name, strlen($matches[1])), $arrayvalue); } else { $value = ar()->getvar($name); } return $value; }
<div class="widget <?php echo $widget['widget_type_alias']; ?>"> <div class="video_box"> <div class="video_img"><img src="<?php echo ar($this->config->item('VIDEO_CAP_PATH') . $widget_video['video']['frameshot'], 264, 124, 'video_widget'); ?>" width="264" height="124"></div> <div class="btn_play"><a href="<?php echo base_url(); ?>js/media/mediaplayer.swf?file=<?php echo $this->config->item('VIDEO_FLV_URL') . $widget_video['video']['flv']; ?>&autostart=1" target="_blank"><img src="images/btn-play.png" width="46" height="47" /></a></div> </div> </div>
public function _call_super($arCallArgs = "") { global $ARCurrent, $AR; $context = $this->getContext(); if (!$arCallArgs) { $arCallArgs = end($ARCurrent->arCallStack); } $arSuperContext = (array) $context['arSuperContext']; $arLibrary = $context['arLibrary']; $arLibraryPath = $context['arLibraryPath']; $arCallType = $context['arCallTemplateType']; $arSuperPath = $context['arCallTemplatePath']; $arLibrariesSeen = $context['arLibrariesSeen']; $arCallFunction = $arSuperFunction = $context['arCallFunction']; if ($arLibrary) { $arSuperFunction = str_replace($arLibrary . ':', '', $arCallFunction); } if (strpos($arSuperFunction, "::") !== false) { // template of a specific class defined via call("class::template"); list($arBaseType, $arSuperFunction) = explode("::", $arSuperFunction); } // remove current library path from the arLibrariesSeen array so that // Ariadne will be able to re-enter the library and toggle the arSuperContext boolean there. unset($arLibrariesSeen[$arLibraryPath]); $arSuperContext[$arSuperPath . ":" . $arCallType . ":" . $arSuperFunction] = true; debug("call_super: searching for the template following (path: {$arSuperPath}; type: {$arCallType}; function: {$arCallFunction}) from {$this->path}"); // FIXME: Redirect code has to move to getPinpTemplate() $redirects = $ARCurrent->shortcut_redirect; if (isset($redirects) && is_array($redirects)) { $redirpath = $this->path; while (!$template['arTemplateId'] && ($redir = array_pop($redirects)) && $redir["keepurl"] && substr($redirpath, 0, strlen($redir["dest"])) == $redir["dest"]) { debug("call_super: following shortcut redirect: {$redirpath}; to " . $redir["dest"]); $template = $this->getPinpTemplate($arCallFunction, $redirpath, $redir["dest"], false, $arLibrariesSeen, $arSuperContext); $redirpath = $redir['src']; } if (!$template["arTemplateId"]) { $template = $this->getPinpTemplate($arCallFunction, $redirpath, '', false, $arLibrariesSeen, $arSuperContext); } } if (!$template["arTemplateId"]) { $template = $this->getPinpTemplate($arCallFunction, $this->path, '', false, $arLibrariesSeen, $arSuperContext); } if ($template["arCallTemplate"] && $template["arTemplateId"]) { $exists = ar('template')->exists($template['arCallTemplatePath'], $template["arCallTemplate"]); if ($exists) { debug("call_super: found template " . $template["arCallTemplate"] . " on object with id " . $template["arTemplateId"]); $arLibrary = $template['arLibrary']; debug("call_super: found template on " . $template["arTemplateId"]); if (is_int($arLibrary)) { // set the library name for unnamed libraries to 'current' // so that calls using getvar('arLibrary') will keep on working $arLibrary = "current"; } if (!is_string($arCallArgs)) { $arCallArgs['arCallFunction'] = $arCallFunction; $arCallArgs['arLibrary'] = $arLibrary; $arCallArgs['arLibraryPath'] = $template["arLibraryPath"]; } $ARCurrent->arCallStack[] = $arCallArgs; $this->pushContext(array("scope" => "pinp", "arSuperContext" => $arSuperContext, "arLibrary" => $arLibrary, "arLibraryPath" => $template['arLibraryPath'], "arCallFunction" => $arCallFunction, "arCurrentObject" => $this, "arCallType" => $template['arCallType'], "arCallTemplateName" => $template['arCallTemplateName'], "arCallTemplateNLS" => $template['arCallTemplateNLS'], "arCallTemplateType" => $template['arCallTemplateType'], "arCallTemplatePath" => $template['arCallTemplatePath'])); $continue = true; $eventData = new object(); if (!$AR->contextCallHandler) { /* prevent onbeforecall from re-entering here */ $AR->contextCallHandler = true; $eventData->arCallArgs = $arCallArgs; $eventData->arCallFunction = $arCallFunction; $eventData->arContext = $this->getContext(); $eventData = ar_events::fire('onbeforecall', $eventData); $ARCurrent->arResult = $eventData->arResult; $AR->contextCallHandler = false; $continue = $eventData != false; } if ($continue) { set_error_handler(array('pobject', 'pinpErrorHandler'), error_reporting()); $func = ar('template')->get($template['arCallTemplatePath'], $template['arCallTemplate']); if (is_callable($func)) { $arResult = $func($this); } restore_error_handler(); if (!$AR->contextCallHandler) { /* prevent oncall from re-entering here */ $AR->contextCallHandler = true; $temp = $ARCurrent->arResult; /* event listeners will change ARCurrent->arResult */ $eventData->arResult = $arResult; ar_events::fire('oncall', $eventData); $ARCurrent->arResult = $temp; /* restore correct result */ $AR->contextCallHandler = false; } } array_pop($ARCurrent->arCallStack); $this->popContext(); } } return $arResult; }
</label> <input id="telephone" type="text" name="telephone" value="<?php $this->showdata("telephone", "none"); ?> " class="inputline wgWizAutoFocus"> </div> <div class="field"> <label for="mobile" class="required"><?php echo $ARnls["mobile"]; ?> </label> <input id="mobile" type="text" name="mobile" value="<?php $this->showdata("mobile", "none"); ?> " class="inputline"> </div> <div class="field"> <label for="emails" class="required"><?php echo $ARnls["email"]; ?> </label> <?php $snippetDef = array('emails' => array('name' => 'emails', 'type' => 'fieldlist', 'label' => false, 'class' => 'inputline', 'value' => $emails)); $formSnippet = ar('html')->form($snippetDef, null, null)->getHTML(); $snippet = $formSnippet->getElementsByTagName('fieldset'); echo (string) $snippet; ?> </div> </fieldset> <?php }
function esiFetch($url) { $scriptName = $_SERVER["SCRIPT_NAME"] ? basename($_SERVER["SCRIPT_NAME"]) : basename($_SERVER["SCRIPT_FILENAME"]); if ($scriptName) { $scriptName = "/" . $scriptName; } $scriptName = "/loader.php"; // FIXME: Bij een request buiten Ariadne om kan het een andere scriptname zijn waardoor de include niet werkt. $url = ESI::esiExpression($url); if (strstr($url, $scriptName)) { // Looks like an Ariadne request, handle it! $urlArr = parse_url($url); parse_str($urlArr['query'], $_GET); // $pathInfo = str_replace($scriptName, '', $urlArr['path']); $pathInfo = substr($urlArr['path'], strpos($urlArr['path'], $scriptName) + strlen($scriptName), strlen($urlArr['path'])); $pathInfo = str_replace("//", "/", $pathInfo); ob_start(); ldProcessRequest($pathInfo); $replacement = ob_get_contents(); ob_end_clean(); // FIXME: Check of the request went ok or not; } else { // FIXME: Is it a good idea to do http requests from the server this way? $client = ar('http')->client(); $scheme = parse_url($url, PHP_URL_SCHEME); if (!$scheme) { $url = 'http:' . $url; } $replacement = $client->get($url); if ($client->statusCode != "200") { return false; } } return $replacement; }
<h1>Casestudies</h1> <?php if (count($casestudies) == 0) { $this->load->view('inc-norecords'); return; } foreach ($casestudies as $casestudy) { ?> <div class="casestudies"> <div class="case_img"><img src="<?php echo ar($this->config->item('CASESTUDY_URL') . $casestudy['image'], 190, 134, 'casestudy'); ?> " width="190" /></div> <div class="case_desc"> <h4><a href="casestudy/details/<?php echo $casestudy['url_alias']; ?> "><?php echo $casestudy['title']; ?> </a></strong></h4> <?php echo word_limiter($casestudy['contents'], 40); ?> <p style="float:right"><a href="casestudy/details/<?php echo $casestudy['url_alias']; ?> ">[read more]</a></p> </div> <div style="clear:both"></div> </div>
public function putFile($filename, $nls = 'none', $originalName = null) { $filename = (string) $filename; $nls = (string) $nls; if (!isset($originalName)) { $originalName = $filename; } $originalName = (string) $originalName; $registeredFiles = (array) $this->store->getvar('registeredFiles'); $error = ''; $fileInfo = ldRegisterFile($originalName, $error); if (!$error) { $cleanInfo = array('name' => $fileInfo[$originalName], 'temp' => $fileInfo[$originalName . '_temp'], 'size' => $fileInfo[$originalName . '_size'], 'type' => $fileInfo[$originalName . '_type']); $registeredFiles[$filename][$nls] = $cleanInfo; $this->store->putvar('registeredFiles', $registeredFiles); $result = $cleanInfo; } else { $result = ar('error')->raiseError($error, 501); } return $result; }
function debug($text, $level = "pinp", $stream = "all", $indent = "") { global $DB, $DB_INDENT; if (!isset($DB[$level])) { $level = "pinp"; } if ($DB["level"] >= $DB[$level] && ($DB["stream"] == "all" || $DB["stream"] == $stream)) { /* format the message */ $message = "[" . $level . "][" . $stream . "] " . $text; $timestamping = date("H:i:s"); /* handle indentation */ if ($indent == "OUT") { $DB_INDENT = substr($DB_INDENT, 0, -2); } if ($indent == "IN") { $DB_INDENT .= " "; } if ($DB["method"]["file"] && $DB["fp"]) { @fwrite($DB["fp"], "(" . $timestamping . ")" . $DB_INDENT . $message . "\n"); @fflush($DB["fp"]); } /* Check if we're debugging to the loader debug_print function and the loader is capable of debugging. */ if ($DB["method"]["loader"] && function_exists("debug_print")) { debug_print("(" . $timestamping . ")" . $DB_INDENT . $message . "\n"); } if ($DB["method"]["syslog"]) { syslog(LOG_NOTICE, "(Ariadne) " . $DB_INDENT . $message); } if ($DB["method"]["firebug"]) { ar('beta/firebug')->log($text, "[" . $level . "][" . $stream . "]"); } } }
$showLanguageSelect = true; } } } echo '</fieldset>'; $languageList = $ARConfig->nls->list; $usedLanguages = $arLanguages; foreach ($usedLanguages as $language) { unset($languageList[$language]); } foreach ($usedLanguages as $extraLanguage) { echo '<input type="hidden" name="arLanguages[]" value="' . htmlspecialchars($extraLanguage) . '">'; if ($extraLanguage != $arLanguage) { echo '<fieldset class="editdata">'; echo '<legend>' . $ARnls['data'] . ' : ' . $ARConfig->nls->list[$extraLanguage] . '</legend>'; foreach ($wgWizFlow as $step) { if ($step['template'] && !$step['nolang']) { $wgWizCallObject->call($step['template'], array("arNewType" => $arNewType, "arLanguage" => $extraLanguage)); } } echo '</fieldset>'; } } if ($showLanguageSelect && sizeof($languageList) > 0) { $fields = array("arLanguages" => array("type" => "select", "options" => $languageList, "label" => false, "name" => "extraLanguage"), "addLanguageHidden" => array("type" => "html", "value" => "<input type='hidden' name='addLanguage' value=''>", "label" => false), "addLanguage" => array("type" => "button", "value" => $ARnls['ariadne:new:add_language'], "label" => false, "class" => "addLanguage")); echo '<fieldset id="languages">'; echo '<legend>' . $ARnls['ariadne:new:extralanguages'] . '</legend>'; echo ar('html')->form($fields, false)->getHTML()->childNodes; echo '</fieldset>'; } }