class P { public static function Main() { if ($x) { function g() { echo "g1\n"; } class T { function f() { echo "T1::f\n"; } } } else { function g() { echo "g2\n"; } class T { function f() { echo "T2::f\n"; } } } $t = new T(); $t->f(); g(); } }
protected function call_plugin_impl($call_ctx) { static $plugin; if (is_null($plugin)) { try { hd_print('Instantiating plugin...'); $plugin = $this->create_plugin(); hd_print('Plugin instance created.'); } catch (Exception $e) { hd_print('Error: can not instantiate plugin (' . $e->getMessage() . ')'); return array(PluginOutputData::has_data => false, PluginOutputData::plugin_cookies => $call_ctx->plugin_cookies, PluginOutputData::is_error => true, PluginOutputData::error_action => ActionFactory::show_error(true, T::t('title_application_error'), array(T::t('msg_plugin_init_failed')))); } } $out_data = null; try { $out_data = $this->invoke_operation($plugin, $call_ctx); } catch (DuneException $e) { hd_print("Error: DuneException caught: " . $e->getMessage()); return array(PluginOutputData::has_data => false, PluginOutputData::plugin_cookies => $call_ctx->plugin_cookies, PluginOutputData::is_error => true, PluginOutputData::error_action => $e->get_error_action()); } catch (Exception $e) { hd_print("Error: Exception caught: " . $e->getMessage()); return array(PluginOutputData::has_data => false, PluginOutputData::plugin_cookies => $call_ctx->plugin_cookies, PluginOutputData::is_error => true, PluginOutputData::error_action => ActionFactory::show_error(true, T::t('title_application_error'), array(T::t('msg_unhandled_plugin_error')))); } $plugin_output_data = array(PluginOutputData::has_data => !is_null($out_data), PluginOutputData::plugin_cookies => $call_ctx->plugin_cookies, PluginOutputData::is_error => false, PluginOutputData::error_action => null); if ($plugin_output_data[PluginOutputData::has_data]) { $plugin_output_data[PluginOutputData::data_type] = $this->get_out_type_code($call_ctx->op_type_code); $plugin_output_data[PluginOutputData::data] = $out_data; } return $plugin_output_data; }
public static function preSetup() { // Using T editor driver to avoid script termination on non-existing xml files // (so that whatever the order in which the extractlng and the install_i18n scripts ar run, it's ok) T::setConfig(array_merge(T::$config, array('driver' => 'editor'))); return true; }
/** * setup search function for filtering and sorting * based on fullName field */ public function search($params, Query $query) { $dataProvider = new ActiveDataProvider(['query' => $query]); /** * Setup your sorting attributes * Note: This is setup before the $this->load($params) * statement below */ $dataProvider->setSort(['attributes' => ['action' => ['label' => T::t('Action'), 'asc' => ['action' => SORT_ASC], 'desc' => ['action' => SORT_DESC], 'default' => SORT_ASC], 'created' => ['label' => T::t('Date'), 'asc' => ['created' => SORT_ASC, 'action' => SORT_ASC], 'desc' => ['created' => SORT_DESC, 'action' => SORT_ASC], 'default' => SORT_DESC], 'task_price' => ['label' => T::t('Reward'), 'asc' => ['task_price' => SORT_ASC, 'action' => SORT_ASC], 'desc' => ['task_price' => SORT_DESC, 'action' => SORT_ASC], 'default' => SORT_DESC]]]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } if (isset($params[$this->formName()])) { foreach ($params[$this->formName()] as $prop => $propValue) { if ("" != $propValue && property_exists($this, $prop)) { /* map objet_id to type */ if (in_array($prop, ['object_id', 'task_price'])) { $query->andWhere(sprintf('%s=%d', $prop, $this->{$prop})); } else { $query->andWhere(sprintf('%s LIKE "%%%s%%"', $prop, $this->{$prop})); } } } } return $dataProvider; }
public function init() { parent::init(); if (zmf::config('closeSite')) { header("Content-type: text/html; charset=utf-8"); exit(zmf::config('closeSiteReason')); } $this->layout = '//layouts/wedding'; $this->currentModule = 'wedding'; // Yii::app()->theme = 'web'; // if (isset($_GET['lang']) && in_array($_GET['lang'], array('zh_cn', 'zh_tw', 'en'))) { // Yii::app()->language = $_GET['lang']; // zmf::delCookie('lang'); // zmf::setCookie('lang', $_GET['lang']); // } // $lang = zmf::getCookie('lang'); // if ($lang != '') { // Yii::app()->language = $lang; // } else { // $countryCode = zmf::getCountryByIp(); // $countryCode = strtoupper($countryCode); // if ($countryCode == 'CN') { // Yii::app()->language = 'zh_cn'; // } elseif (in_array($countryCode, array('HK', 'MO', 'TW'))) { // Yii::app()->language = 'zh_tw'; // } elseif ($countryCode == 'IANA') { // Yii::app()->language = 'zh_cn'; // } else { // Yii::app()->language = 'en'; // } // zmf::setCookie('lang', Yii::app()->language); // } }
function init() { parent::init(); $this->layout = '/layouts/user'; $this->currentModule = 'user'; if ($this->isMobile == 'yes') { $this->message(0, '感谢你的支持!本页面暂还在拼命制作中...'); } $this->uid = zmf::filterInput($_GET['id']); if (!$this->uid) { $this->uid = zmf::uid(); } if (!$this->uid) { $this->redirect(array('site/login')); } if ($this->uid == zmf::uid()) { $this->mySelf = 'yes'; } if ($this->mySelf != 'yes') { if (zmf::uid()) { $_favorinfo = Favorites::checkFavored($this->uid, 'user'); if ($_favorinfo) { $this->favored = true; } } } $this->userInfo = Users::getUserInfo($this->uid); if ($this->userInfo['tagids'] != '') { $this->userTags = Tags::getByIds($this->userInfo['tagids']); } $this->pageTitle = $this->userInfo['truename'] . ' - ' . zmf::config('sitename'); $this->pageDescription = $this->userInfo['truename'] . '的【' . zmf::config('sitename') . '】的个人主页,包括TA的原创文章、精美图片及各类悉心收藏,快来看看吧!'; }
private function getStringsFromXML($file) { if (!file_exists($file)) { if (!touch($file)) { throw new Exception('Unable to create file ' . $file); } } return parent::getStringsFromXML($file); }
public static function load($pluginPath, $domain = "") { if (!function_exists("bindtextdomain") or strpos($_SERVER["SERVER_SOFTWARE"], "BitWebServer") !== false) { return; } self::$domainPaths[$domain] = $pluginPath . "/locale"; if (!self::$localeSet) { setlocale(LC_MESSAGES, Session::getLanguage() . ".UTF-8"); self::$localeSet = true; } self::D($domain); bindtextdomain("messages{$domain}", self::$domainPaths[$domain]); bind_textdomain_codeset("messages{$domain}", "UTF-8"); }
function fetch() { $res = '<form id="sis4bform" method="POST" action="' . $this->getOption('request_url') . '" />'; $res .= '<input type="hidden" name="var1" value="' . $this->getOrderId() . '" />'; $res .= '<input type="hidden" name="var2" value="' . $this->getOption('merchant_id') . '" />'; $res .= '<input type="hidden" name="var3" value="' . T::getLocale() . '" />'; $button = $this->getOption('button'); if ($button) { $res .= $button; } else { $res .= '<input type="submit" name="__submit__" value="' . __('Valider') . '" />'; } $res .= '</form>'; return $res; }
public function execute($params) { $lang = $params[0]; if (!in_array($lang, Config::getAllLangs())) { throw new Exception('Specified lang is not part of this project handled languages'); } foreach (FileUtils::getAllFiles(APP_ROOT . 'app/' . APP_NAME) as $file) { $result = preg_match_all('`(?:__|_e)\\(\'(.+)\'(?:,array\\(.+\\))?\\)`sU', file_get_contents($file), $matches); foreach ($matches[1] as $elem) { $nbfound++; __(str_replace("\\'", "'", $elem)); } } $arr = T::getInstance($lang)->getStrings(); T::getInstance($lang)->save(true); }
public function getHTML($id, $page) { $this->loadMultiPageMode($id, $page, 0); T::load(dirname(__FILE__), "UPnP"); $gui = new HTMLGUIX($this); $gui->version("mUPnP"); $gui->screenHeight(); $gui->name("UPnP"); $gui->attributes(array("UPnPName")); $B = $gui->addSideButton("Geräte\nerkennen", "lieferschein"); $B->popup("", "UPnP-Geräte", "mUPnP", "-1", "discoverNow", array("''", "1")); $B = $gui->addSideButton("Remote\nanzeigen", "./fheME/UPnP/remote.png"); $B->onclick("UPnP.show();"); $B = $gui->addSideButton("Radio-\nStationen", "./fheME/UPnP/radio.png"); $B->loadFrame("contentRight", "mUPnPRadioStation"); return $gui->getBrowserHTML($id); }
function set($name) { //@todo rename this to just set $newPlace = 'app/themes/' . $name; D::log(LOC . '/' . $newPlace, 'new Place'); if(is_dir(LOC . '/' . $newPlace)) { if(substr(URL, -1) == '?') { T::$url = $this->themeUrl = substr(URL, 0, -1) . $newPlace; } else { T::$url = $this->themeUrl = URL . $newPlace; } T::$loc = LOC . '/' . $newPlace; //$this->libs->Config->set('site', 'theme', $newPlace); return true; } else { D::error('Theme doesn\'t exist'); } }
public function getHTML($id, $page) { T::load(dirname(__FILE__), "Wecker"); $this->setParser("WeckerTime", "Util::CLTimeParser"); $this->addJoinV3("Device", "WeckerDeviceID", "=", "DeviceID"); $this->loadMultiPageMode($id, $page, 0); $gui = new HTMLGUIX($this); $gui->version("mWecker"); $gui->screenHeight(); $gui->name("Wecker"); $gui->attributes(array("DeviceName", "WeckerTime")); $gui->colStyle("WeckerTime", "text-align:right;"); #$B = $gui->addSideButton("Alex,\nsing!", "new"); #$B->onclick("alex.sing('http://gffstream.ic.llnwd.net/stream/gffstream_w14a', 0, 100)"); #$B = $gui->addSideButton("Alex,\nstop!", "new"); #$B->onclick("alex.beQuiet()"); return $gui->getBrowserHTML($id); }
function init() { parent::init(); if (zmf::config('closeSite')) { header("Content-type: text/html; charset=utf-8"); exit(zmf::config('closeSiteReason')); } $this->uid = zmf::uid(); if (!Yii::app()->user->isGuest) { $uid = Yii::app()->user->id; $userInfo = Users::getUserInfo($uid); $this->truename = $userInfo['username']; $this->userInfo = $userInfo; } $this->pageTitle = zmf::config('sitename'); self::_referer(); $this->mobileTitle = zmf::config('sitename'); }
function set($name) { //@todo rename this to just set $newPlace = 'themes/' . $name; D::log($name, 'Theme Set'); // D::log(URL, 'URL'); if(is_dir(APP_FOLDER . '/' . $newPlace)) { if(defined('URL')) { if(substr(URL, -1) == '?') { T::$url = $this->themeUrl = substr(URL, 0, -1) . APP_NAME . '/' . $newPlace . '/'; } else { T::$url = $this->themeUrl = URL . APP_NAME . '/' . $newPlace . '/'; } } T::$loc = $this->themeLoc = APP_FOLDER . '/' . $newPlace; //$this->libs->Config->set('site', 'theme', $newPlace); return true; } else { D::error('Theme doesn\'t exist'); } }
function init() { parent::init(); if (zmf::config('closeSite')) { header("Content-type: text/html; charset=utf-8"); exit(zmf::config('closeSiteReason')); } $this->uid = zmf::uid(); if ($this->uid) { $uid = $this->uid; $userInfo = Users::getUserInfo($uid); $this->truename = $userInfo['truename']; $this->userInfo = $userInfo; $this->userCode = zmf::jiaMi('zmf#' . $this->uid); } $this->pageTitle = zmf::config('sitename'); $this->mobileTitle = zmf::config('sitename'); if ($this->isMobile == 'yes') { Yii::app()->theme = 'mobile'; } else { Yii::app()->theme = 'naodong'; } self::_referer(); }
$groupindex['updateline'] = TIMESTAMP; $groupdata = DB::fetch_first("SELECT SUM(todayposts) AS todayposts, COUNT(fid) AS groupnum FROM " . DB::table('forum_forum') . " WHERE status='3' AND type='sub'"); $groupindex['todayposts'] = $groupdata['todayposts']; $groupindex['groupnum'] = $groupdata['groupnum']; save_syscache('groupindex', $groupindex); DB::query("TRUNCATE " . DB::table('forum_groupfield')); $tpl = dir(DISCUZ_ROOT . './data/template'); while ($entry = $tpl->read()) { if (preg_match("/\\.tpl\\.php\$/", $entry)) { @unlink(DISCUZ_ROOT . './data/template/' . $entry); } } $tpl->close(); header('Location: tools.php?action=updatesuccess'); } else { $t = new T(); $t->init(); $config = $t->config; if ($action == 'index') { //首页 show_header(); print <<<END \t\t<p>欢迎使用 Tools 之 Discuz! 急诊箱功能!我们致力于为您解决 Discuz! 站点的紧急故障,欢迎各位站长朋友们使用。</p> \t\t<tr><td> \t\t<h5>适用版本:</h5> \t\t<ul> \t\t\t<li>{$tools_discuz_version}</li> \t\t</ul> \t\t<h5>主要功能:</h5> \t\t<ul> \t\t\t<li>重置管理员账号:将把您指定的会员设置为管理员</li>
?> <a target="targetFrame" href="<?php echo Yii::app()->createUrl($application->route . '/update', array('id' => $application->applicationId)); ?> "> <?php if ($application->color == 'blackWhiteFont') { ?> ✝ <?php } ?> <?php echo T::formatDateFromDb($application->arrivedDate); ?> <?php echo $application->applicationId; ?> <?php echo $application->name; ?> <?php echo $application->surname; ?> <?php // if ($application->color == 'white' || $application->color == 'turquoiseLight') { if ($application->hasDownselledApplication == 1) {
* * * @package M * @subpackage M_Office * @author Arnaud Sellenet <demental at github> * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License * @version 0.1 */ if (!defined('ROOT_ADMIN_SCRIPT')) { define('ROOT_ADMIN_SCRIPT', ''); } if (!defined('OFFICE_TEMPLATES_FOLDER')) { define('OFFICE_TEMPLATES_FOLDER', realpath(dirname(__FILE__)) . '/Office/Templates/'); } $dispatchopt =& PEAR::getStaticProperty('Dispatcher', 'global'); T::addPath(dirname(__FILE__) . '/Office/lang/'); /** * * "Office" application dispatcher * The office application is one of the most powerful features of the M framework. * It's also the one that needs most refactoring * This was originally base upon Justin Patrin's PEAR_DB_DataObject_FormBuilder_Frontend * * */ class M_Office extends M_Office_Controller implements iListener { public static $dsp = '__defaut/index'; public function __construct($layout = 'main') { parent::__construct();
public static function &getSearchForm($do, $module) { MyQuickForm::registerElementType('advandate', 'HTML/QuickForm/advandate.php', 'HTML_QuickForm_advandate'); $form = new MyQuickForm('formSearch', 'GET', self::getQueryParams(array(), array('page', '_c_'), false)); $fields = $_GET; unset($fields['_c_']); unset($fields['page']); unset($fields['module']); unset($fields['action']); unset($fields['filterField']); unset($fields['filterValue']); if (count($fields) == 0) { Log::info('caching search form'); $cache = true; } else { Log::info('NO SEARCH FORM CACHING'); $cache = false; } $cacheName = 'searchform_' . $module; $options = array('caching' => $cache, 'cacheDir' => APP_ROOT . 'app/' . APP_NAME . '/cache/forms/', 'lifeTime' => 3600, 'fileNameProtection' => false); $cache = new Cache_Lite($options); if ($_cachedData = $cache->get($cacheName)) { Mreg::append('autoloadcallback', array(array('MyQuickForm', 'autoloadElements'))); $_cachedData = unserialize($_cachedData); foreach ($_cachedData as $element) { $form->addElement($element); } } else { $do->fb_selectAddEmpty = array(); if (is_array($do->links())) { foreach ($do->links() as $field => $link) { $do->fb_selectAddEmpty[] = $field; } } if (is_array($do->fb_enumFields)) { foreach ($do->fb_enumFields as $field) { $do->fb_selectAddEmpty[] = $field; } } $do->fb_formHeaderText = __('Search'); $do->fb_submitText = '>>'; $do->fb_linkNewValue = false; $formBuilder =& MyFB::create($do); $formBuilder->_cacheOptions = array('name' => 'office_searchform', 'cacheDir' => APP_ROOT . 'app/' . APP_NAME . '/cache/forms/'); $formBuilder->preGenerateFormCallback = array($do, 'prepareSearchForm'); $do->prepareSearchForm($fb); $do->fb_userEditableFields = $do->fb_fieldsToRender; $table = $do->table(); foreach ($do->fb_fieldsToRender as $field) { if ($table[$field] & DB_DATAOBJECT_DATE || $table[$field] & DB_DATAOBJECT_TIME) { $label = $do->fb_fieldLabels[$field] ? $do->fb_fieldLabels[$field] : $field; $do->fb_preDefElements[$field] = MyQuickForm::createElement('advandate', $field, $label, array("language" => T::getLang())); } } $formBuilder->postGenerateFormCallback = array($do, 'postPrepareSearchForm'); $formBuilder->useForm($form); $formBuilder->getForm(); foreach ($form->_elements as $elem) { $cached[] = $elem; } if ($cache) { $cache->save(serialize($cached)); } } $form->_rules = array(); $form->_formRules = array(); $form->_required = array(); self::addHiddenFields($form, array('search', 'page', '__dontpaginate', '_c_'), true); $form->addElement('checkbox', '__dontpaginate', 'Afficher les résultats sur une seule page'); return $form; }
<?php $b = 0; $c = "Salut"; $len = strlen($c); function fct($a) { return $a . "_1\n"; } class T { function foo() { echo "test\n"; } } echo fct(0); echo T::foo(); echo $_GET['a']; die("foo"); $b = str_replace($c, 'F', 'a');
private function sideButtons($bps = null) { T::D($this->className); $ST = ""; if (count($this->sideButtons) > 0 and ($bps == null or !isset($bps["selectionMode"]))) { $position = "left"; if ($this->object instanceof PersistentObject) { $position = "right"; } if ($this->displayMode == "BrowserLeft") { $position = "right"; } $ST = new HTMLSideTable($position); $ST->setTableID("SideTable" . get_class($this->object)); foreach ($this->sideButtons as $B) { $ST->addRow($B . ""); } } T::D(""); return $ST; }
<?php echo B::xhtml5(array('head' => B::head(array('title' => 'SweetFramework Project Test')), 'body' => B::body(array('header' => B::header(array('title' => 'Project Test', 'nav' => T::get('site/nav'))), 'content' => array(B::h1(array('text' => 'Projects')), B::ul(array('items' => D::log(array_map(function ($v) { return V::get('project/detail', array('project' => $v)); }, $projects), 'projects')))), 'footer' => B::footer(array('text' => 'Copyright ajcates ' . date('Y')))))));
<?php trait T { public function m() { echo "original\n"; } } class A { use T; } class B { use T; } T::m(); $a1 = new A(); $a1->m(); fb_intercept("T::m", function () { echo "new\n"; }); $a2 = new A(); $a2->m(); $b1 = new B(); $b1->m(); T::m();
?> /*setTimeout(function(){ if($j.jStorage.get('phynxUserCert', null) == null && $j('#buttonCertificateLogin').length > 0) $j('#buttonCertificateLogin').css('opacity', '0.2'); else userControl.autoCertificateLogin(); } , 500); */ }); </script> <div style="display:none;" id="messageSetup" title="Ersteinrichtung"> <?php echo T::_("Bitte verwenden Sie '<b>Admin</b>' als Benutzername und als Passwort, um mit der Ersteinrichtung dieser Anwendung fortzufahren."); ?> </div> <div style="display:none;" id="messageTouch" title="Touch-Eingabe"> <?php echo T::_("Ihr Gerät unterstützt Touch-Eingaben. Möchten Sie die Touch-Optimierungen aktivieren? Maus-Eingaben werden dann nicht mehr funktionieren.<br /><br />Wenn Sie 'Ja' auswählen, wird die Anwendung neu geladen. Sie können diese Auswahl mit dem %1-Knopf rechts unten rückgängig machen.", "<span class=\"iconic iconicG cursor\"></span>"); ?> </div> <div style="display:none;" id="messageTouchReset" title="Touch-Eingabe"> <?php echo T::_("Möchten Sie die Eingabemethode zurücksetzen? Sie werden dann erneut gefragt, ob Sie die Touch-Optimierungen nutzen möchten.<br /><br />Wenn Sie 'Ja' auswählen, wird die Anwendung neu geladen."); ?> </div> </body> </html>
<?php if (0) { if (!($a = $b->B($c))) { $d['C'] = (string) $e->D->E; } $f = F($g, G($h->H->I)); for ($i = 1; $j < $k; $l++) { $m = $n->J->K[$o]; $p = array('L' => NULL) + $q->M(N); $r = array(); foreach ($s as $t => $u) { foreach ($v->O($w) as $x => $y) { $z[$aa . ($ab ? 'P' : 'Q') . $ac] = (string) $ad; } } $ae['R'][] = $af; } } else { return S; } T::U()->V($ag, $ah); return $ai;
function getHTML() { if ($this->content == null) { return ""; } $cols = ""; $rows = ""; for ($i = 0; $i < $this->numCols; $i++) { $cols .= "\n\t\t\t\t<col " . (isset($this->colWidth[$i + 1]) ? "style=\"width:" . $this->colWidth[$i + 1] . "\"" : "") . " class=\"" . (!isset($this->colClass[$i + 1]) ? "backgroundColor" . ($i % 2 + 2) . "" : $this->colClass[$i + 1]) . "\" />"; } if (count($this->header) > 0) { $rows .= "\n\t\t\t<thead>\n\t\t\t<tr " . (isset($this->rowClasses[-1]) ? "class=\"" . $this->rowClasses[-1] . "\"" : "") . ">"; foreach ($this->header as $K => $V) { if ($this->colOrder != null and isset($this->colOrder[$K])) { $j = $this->colOrder[$K] - 1; } else { $j = $K; } #$style = ""; $style = isset($this->colStyles[$j + 1]) ? $this->colStyles[$j + 1] : ""; #if(isset($this->cellStyles[$K][$j+1])) $style .= $this->cellStyles[$K][$j+1]; if ($style != "") { $style = "style=\"{$style}\""; } $rows .= "\n\t\t\t\t<th {$style}>" . (($this->colOrder != null and isset($this->colOrder[$K])) ? $this->header[$this->colOrder[$K] - 1] : $V) . "</th>"; } $rows .= "\n\t\t\t</tr>\n\t\t\t</thead>"; } $this->tab = 1; if (count($this->tablePart) > 0) { $headRows = $this->getHTMLForUpdate(true, "thead"); if ($headRows != "") { $rows .= "\n\t\t\t\t<thead>\n\t\t\t\t\t{$headRows}\n\t\t\t\t</thead>"; } } $rows .= "\n\t\t\t<tbody>\n\t\t\t\t" . $this->getHTMLForUpdate(true, "tbody") . "\n\t\t\t</tbody>"; if (count($this->tablePart) > 0) { $footRows = $this->getHTMLForUpdate(true, "tfoot"); if ($footRows != "") { $rows .= "\n\t\t\t\t<tfoot>\n\t\t\t\t\t{$footRows}\n\t\t\t\t</tfoot>"; } } $divStyle = ""; if (preg_match("/width:([0-9 ]*)px;/", $this->tableStyle, $regs)) { $divStyle = "style=\"" . $regs[0] . "\""; } $tabClass = "backgroundColor1 Tab"; if ($this->weight == "light") { $tabClass = "lightTab borderColor1"; } $R = "<div>\n\t\t" . ($this->caption != null ? "\n\t\t\t\n\t\t\t<div class=\"{$tabClass} browserContainerSubHeight\" {$divStyle}>\n\t\t\t\t<p>" . T::_($this->caption) . "</p>\n\t\t\t</div>" : ""); if ($this->tab == 1) { $R .= "\n\t\t<div " . ($this->maxHeight != null ? "style=\"max-height:{$this->maxHeight}px;overflow:auto;\"" : "") . ">\n\t\t<table " . ($this->tableStyle != null ? "style=\"{$this->tableStyle}\"" : "") . " " . ($this->tableID != null ? "id=\"{$this->tableID}\"" : "") . " " . ($this->tableClass != "" ? "class=\"{$this->tableClass}\"" : "") . ">\n\t\t\t<colgroup>{$cols}\n\t\t\t</colgroup>"; } $R .= "\n\t\t\t{$rows}\n\t\t</table>\n\t\t</div>"; if ($this->tab > 1) { $R .= "\n\t\t</form>\n\t\t</div>\n\t\t"; } $R .= "</div>"; return $R . ($this->appendJS != "" ? OnEvent::script($this->appendJS) : ""); }
public function getEditTableHTML($cols = 2) { BPS::unsetProperty($this->className . "GUI", "edit"); if ($this->attributes == null) { $this->attributes = PMReflector::getAttributesArrayAnyObject($this->object->getA()); } if ($this->name == null) { $this->name = $this->className; } $BA = $this->getAbortButton(); if (isset($this->features["CRMEditAbove"])) { $BA->style("float:left;margin-left:10px;margin-top:10px;"); } $Buttons = ""; foreach ($this->sideButtons as $B) { if (isset($this->features["CRMEditAbove"])) { $B->style("float:left;margin-left:10px;margin-top:10px;"); } $Buttons .= $B; } $abort = "<div>{$BA}{$Buttons}</div><div style=\"clear:left;height:10px;\"></div>"; $tab = new HTMLForm($this->className . "Form", $this->attributes, $this->name . " editieren:"); if ($cols != 2) { $tab->cols($cols); } foreach ($this->labels as $k => $v) { $tab->setLabel($k, $v); } foreach ($this->types as $k => $v) { $tab->setType($k, $v, null, isset($this->options[$k]) ? $this->options[$k] : null); } foreach ($this->spaces as $k => $v) { $tab->insertSpaceAbove($k, $v); } foreach ($this->autocomplete as $k => $a) { $tab->setAutoComplete($k, $a[0], $a[1]); } foreach ($this->fieldButtons as $k => $B) { $tab->addFieldButton($k, $B); } foreach ($this->parsers as $n => $l) { $tab->setType($n, "parser", null, array($l, $this->object)); } foreach ($this->inputStyles as $k => $n) { $tab->setInputStyle($k, $n); } foreach ($this->descriptionsField as $n => $l) { $tab->setDescriptionField($n, T::_($l)); } $tab->setValues($this->object); if ($this->object->getID() == -1) { $save = $this->functionSaveNew; } else { $save = $this->functionSave; } $tab->setSaveClass($this->className, $this->object->getID(), str_replace(array("%CLASSNAME", "%CLASSID"), array($this->className, $this->object->getID()), $save), $this->name); $tab->useRecentlyChanged(); return $abort . $tab; }
public static function popup($title, $targetClass, $targetClassId, $targetMethod, $targetMethodParameters = "", $bps = "", $popupOptions = null, $popupName = "edit") { return "Popup.load('" . T::_($title) . "', '{$targetClass}', '{$targetClassId}', '{$targetMethod}', Array(" . (is_array($targetMethodParameters) ? implode(",", $targetMethodParameters) : "'" . $targetMethodParameters . "'") . "), '{$bps}', '{$popupName}'" . ($popupOptions != null ? ", '" . addslashes($popupOptions) . "'" : "") . ");"; }
/** * Returns whether the type of `$X` matches a specific type * @example Demonstration * ```php * $var = '123'; * var_dump( type::matches($var, 'boolean') ); * var_dump( type::matches($var, 'bool') ); // Shorten name * echo "\n"; * var_dump( type::matches($var, 'integer') ); * var_dump( type::matches($var, 'int') ); // Shorten name * echo "\n"; * var_dump( type::matches($var, 'string') ); * var_dump( type::matches($var, 'str') ); // Shorten name * echo "\n"; * var_dump( type::matches($var, 'array') ); * var_dump( type::matches($var, 'arr') ); // Shorten name * ``` * @example Pseudo type matching * ```php * $var1 = '123'; * var_dump( type::matches($var1, 'numeric') ); * echo "\n"; * $var2 = array (1, 2, 3); * var_dump( type::matches($var2, 'scalar') ); * var_dump( type::matches($var2, 'vector') ); * echo "\n"; * $var3 = function () { }; * var_dump( type::matches($var3, 'callable') ); * ``` * @example Class matching * ```php * class Cat { } * class Dog { } * class Collie extends Dog { } * * $dog = new Collie(); * var_dump( type::matches($dog, 'Collie') ); // Matches * var_dump( type::matches($dog, 'Dog') ); // Also matches with super-class * var_dump( type::matches($dog, 'Cat') ); // Never matches * ``` * @param mixed $X A variable to check type * @param integer|string $Type A type expression * @return boolean */ static function matches($X, $Type) { switch (is_int($Type) ? $Type : T::enum($Type)) { case T::BOOL: return is_bool($X); case T::INT: return is_int($X); case T::FLOAT: return is_float($X); case T::STR: return is_string($X); case T::ARR: return is_array($X); case T::OBJ: return is_object($X); case T::RES: return is_resource($X); case T::UNKNOWN: if (!is_string($Type)) { return false; } switch ($Type) { case 'mixed': return true; case 'numeric': return is_numeric($X); case 'callable': return is_callable($X); case 'scalar': return is_scalar($X); case 'vector': return !is_scalar($X); default: if (is_object($X)) { // Assumes class name if (is_a($X, $Type)) { return true; } } if (gettype($X) == $Type) { return true; } } } return false; }