function sendMail($params) { // Cargar todas las constantes definidas $constants = get_defined_constants(); // Obtener la direccion a la cual se va a enviar (TO) $to = $params['to']; // Obtener la direccion a la cual se va a enviar (CC) $cc = $params['cc']; // Obtener la direccion a la cual se va a enviar (BCC) $bcc = $params['bcc']; // Obtener el subject del mail $subject = $params['subject']; // Obtener el path del template $template = $constants[strtoupper($params['TEMPLATE'])]; // Cargar parametros del mail $mail = new Mail(); $mail->from = MAIL_FROM; $mail->to = $to; $mail->cc = $cc; $mail->bcc = $bcc; $mail->subject = $subject; $mail->body = MailHelper::_getBody($template, $params); // Si el cuerpo excede cierta cantidad de caracteres, se codifica // en base64 $mail->base64 = strlen($mail->body) > CANT_CARACTERES_EMAIL; // Enviar mail return $mail->send(); }
function query($path, $content = array(), $method = 'GET') { @ini_set('track_errors', 1); // @ - may be disabled $file = @file_get_contents($this->_url . ($this->_db != "" ? "{$this->_db}/" : "") . $path, false, stream_context_create(array('http' => array('method' => $method, 'content' => json_encode($content), 'ignore_errors' => 1)))); if (!$file) { $this->error = $php_errormsg; return $file; } if (!preg_match('~^HTTP/[0-9.]+ 2~i', $http_response_header[0])) { $this->error = $file; return false; } $return = json_decode($file, true); if (!$return) { $this->errno = json_last_error(); if (function_exists('json_last_error_msg')) { $this->error = json_last_error_msg(); } else { $constants = get_defined_constants(true); foreach ($constants['json'] as $name => $value) { if ($value == $this->errno && preg_match('~^JSON_ERROR_~', $name)) { $this->error = $name; break; } } } } return $return; }
public function __construct() { parent::__construct("lint-const-literals", "Lint (use of lower- or mixed-case string literals)"); foreach (get_defined_constants() as $const_name => $value) { $this->system_constants[$const_name] = true; } }
static function load($file, $return = false) { if (file_exists($file)) { $before = get_defined_constants(); // 数组返回值方式定义 $lang = (include $file); if (!is_array($lang)) { if (isset($_lang)) { // 采用 $_lang['aaa']= value 方式 $lang =& $_lang; } else { // 采用define('aaa',value) 方式 $after = get_defined_constants(); $define = array_diff_assoc($after, $before); $lang = $define; } } self::$_lang = array_merge(self::$_lang, array_change_key_case($lang)); unset($lang); if ($return) { return self::$_lang; } } else { return false; } }
function osc_theme_toggle($params, $content = null) { global $_oscitas_accordion; extract(shortcode_atts(array('title' => 'title', 'class' => ''), $params)); $con = do_shortcode($content); $index = count($_oscitas_accordion) - 1; $id = isset($_oscitas_accordion[$index]['details']) ? 'details-' . $index . '-' . count($_oscitas_accordion[$index]['details']) : 'details-' . $index . '-0'; $const = get_defined_constants(); $_oscitas_accordion[$index]['details'][] = <<<EOS <div class="panel panel-default{$const['EBS_CONTAINER_CLASS']}"> <div class="panel-heading{$const['EBS_CONTAINER_CLASS']}"> <h4 class="panel-title{$const['EBS_CONTAINER_CLASS']}"> <a class="accordion-toggle{$const['EBS_CONTAINER_CLASS']} collapsed" data-toggle="collapse" data-parent="#oscitas-accordion-{$index}" href="#{$id}"> {$title} </a> </h4> </div> <div id="{$id}" class="panel-collapse collapse {$class}{$const['EBS_CONTAINER_CLASS']}"> <div class="panel-body{$const['EBS_CONTAINER_CLASS']}">{$con}</div> </div> </div> EOS; }
/** * Save the max id of every table. Thus when we convert again, when can delete id larger then the saved max id. * * @access public * @return void */ public function saveState() { /* Get user defined tables. */ $constants = get_defined_constants(true); $userConstants = $constants['user']; /* These tables needn't save. */ unset($userConstants['TABLE_BURN']); unset($userConstants['TABLE_GROUPPRIV']); unset($userConstants['TABLE_PROJECTPRODUCT']); unset($userConstants['TABLE_PROJECTSTORY']); unset($userConstants['TABLE_STORYSPEC']); unset($userConstants['TABLE_TEAM']); unset($userConstants['TABLE_USERGROUP']); /* Get max id of every table. */ foreach ($userConstants as $key => $value) { if (strpos($key, 'TABLE') === false) { continue; } if ($key == 'TABLE_COMPANY') { continue; } $state[$value] = (int) $this->dao->select('MAX(id) AS id')->from($value)->fetch('id'); } $this->session->set('state', $state); }
/** * Set up * * @return void */ public function setUp() { //session_start(); // cleaning constants if (PMA_HAS_RUNKIT) { $this->oldIISvalue = 'non-defined'; $defined_constants = get_defined_constants(true); $user_defined_constants = $defined_constants['user']; if (array_key_exists('PMA_IS_IIS', $user_defined_constants)) { $this->oldIISvalue = PMA_IS_IIS; runkit_constant_redefine('PMA_IS_IIS', null); } else { runkit_constant_add('PMA_IS_IIS', null); } $this->oldSIDvalue = 'non-defined'; if (array_key_exists('SID', $user_defined_constants)) { $this->oldSIDvalue = SID; runkit_constant_redefine('SID', null); } else { runkit_constant_add('SID', null); } } $_SESSION['PMA_Theme'] = Theme::load('./themes/pmahomme'); $GLOBALS['server'] = 0; $GLOBALS['PMA_Config'] = new PMA\libraries\Config(); $GLOBALS['PMA_Config']->enableBc(); }
/** * Returns a cURL option from a Response. * * @param Response $response Response to get cURL option from. * @param integer $option cURL option to get. * * @throws \BadMethodCallException * @return mixed Value of the cURL option. */ public static function getCurlOptionFromResponse(Response $response, $option = 0) { switch ($option) { case 0: // 0 == array of all curl options $info = array(); foreach (self::$curlInfoList as $option => $key) { $info[$key] = $response->getInfo($option); } break; case CURLINFO_HTTP_CODE: $info = $response->getStatusCode(); break; case CURLINFO_SIZE_DOWNLOAD: $info = $response->getHeader('Content-Length'); break; default: $info = $response->getInfo($option); break; } if (!is_null($info)) { return $info; } $constants = get_defined_constants(true); $constantNames = array_flip($constants['curl']); throw new \BadMethodCallException("Not implemented: {$constantNames[$option]} ({$option}) "); }
public function run(&$params) { if (!defined('BUILD_LITE_FILE')) { return; } $litefile = C('RUNTIME_LITE_FILE', null, RUNTIME_PATH . 'lite.php'); if (is_file($litefile)) { return; } $defs = get_defined_constants(true); $content = 'namespace {$GLOBALS[\'_beginTime\'] = microtime(TRUE);'; if (MEMORY_LIMIT_ON) { $content .= '$GLOBALS[\'_startUseMems\'] = memory_get_usage();'; } // 生成数组定义 unset($defs['user']['BUILD_LITE_FILE']); $content .= $this->buildArrayDefine($defs['user']) . '}'; // 读取编译列表文件 $filelist = is_file(CONF_PATH . 'lite.php') ? include CONF_PATH . 'lite.php' : array(THINK_PATH . 'Common/functions.php', COMMON_PATH . 'Common/function.php', CORE_PATH . 'Think' . EXT, CORE_PATH . 'Hook' . EXT, CORE_PATH . 'App' . EXT, CORE_PATH . 'Dispatcher' . EXT, CORE_PATH . 'Log' . EXT, CORE_PATH . 'Log/Driver/File' . EXT, CORE_PATH . 'Route' . EXT, CORE_PATH . 'Controller' . EXT, CORE_PATH . 'View' . EXT, CORE_PATH . 'Storage' . EXT, CORE_PATH . 'Storage/Driver/File' . EXT, CORE_PATH . 'Exception' . EXT, BEHAVIOR_PATH . 'ParseTemplateBehavior' . EXT, BEHAVIOR_PATH . 'ContentReplaceBehavior' . EXT); // 编译文件 foreach ($filelist as $file) { if (is_file($file)) { $content .= compile($file); } } // 处理Think类的start方法 $content = preg_replace('/\\$runtimefile = RUNTIME_PATH(.+?)(if\\(APP_STATUS)/', '\\2', $content, 1); $content .= "\nnamespace { Think\\Think::addMap(" . var_export(\Think\Think::getMap(), true) . ");"; $content .= "\nL(" . var_export(L(), true) . ");\nC(" . var_export(C(), true) . ');Think\\Hook::import(' . var_export(\Think\Hook::get(), true) . ');Think\\Think::start();}'; // 生成运行Lite文件 file_put_contents($litefile, strip_whitespace('<?php ' . $content)); }
function help() { $const = get_defined_constants(true); ob_start(); echo '<br />'; echo '------------Constants: --------------------<br />'; foreach ($const['user'] as $key => $name) { echo "{$key} => {$name}<br />"; } $method = get_class_methods($this); echo '<br />'; echo '-------------Methods: ---------------<br />'; print_r($method); $include = get_included_files(); echo '<br />'; echo '-------------Include Files ---------------<br />'; print_r($include); $header = getallheaders(); echo '<br />'; echo '-------------Header: ---------------<br />'; print_r($header); $msg = ob_get_contents(); ob_end_clean(); $this->getError($msg); }
function mysqli_field_flags($result, $field_offset) { static $flags; $flags_num = mysqli_fetch_field_direct($result, $field_offset)->flags; if (!isset($flags)) { $flags = array(); $constants = get_defined_constants(true); foreach ($constants['mysqli'] as $c => $n) { if (preg_match('/MYSQLI_(.*)_FLAG$/', $c, $m)) { if (!array_key_exists($n, $flags)) { $flags[$n] = $m[1]; } } } } $result = array(); foreach ($flags as $n => $t) { if ($flags_num & $n) { $result[] = $t; } } $return = implode(' ', $result); $return = str_replace('PRI_KEY', 'PRIMARY_KEY', $return); $return = strtolower($return); return $return; }
static function info($type = 1) { $type_list = array('basic', 'const', 'variable', 'function', 'class', 'interface', 'file'); if (is_int($type) && $type < 7) { $type = $type_list[$type]; } switch ($type) { case 'const': $const_arr = get_defined_constants(true); return $const_arr['user']; //2因作用域,请在外边直接调用函数 //2因作用域,请在外边直接调用函数 case 'variable': return 'please use: get_defined_vars()'; case 'function': $fun_arr = get_defined_functions(); return $fun_arr['user']; case 'class': return array_slice(get_declared_classes(), 125); case 'interface': return array_slice(get_declared_interfaces(), 10); case 'file': return get_included_files(); default: return array('system' => php_uname(), 'service' => php_sapi_name(), 'php_version' => PHP_VERSION, 'frame_name' => config('frame|name'), 'frame_version' => config('frame|version'), 'magic_quotes' => get_magic_quotes_gpc(), 'time_zone' => date_default_timezone_get()); } }
/** * {@inheritdoc} */ protected function render() { $constants = get_defined_constants(true); if (!empty($constants["user"])) { $maxLength = 0; foreach ($constants["user"] as $name => $value) { $maxLength = max($maxLength, strlen($name)); } foreach ($constants["user"] as $name => $value) { $name = str_pad($name, $maxLength, " ", STR_PAD_RIGHT); switch (gettype($value)) { case "string": $value = str_replace(array("\n", "\r", "\t"), array("\\n", "\\r", "\\t"), $value); break; case "bool": case "boolean": $value = $value ? "true" : "false"; $value = "<<2>>{$value}"; break; case "null": case "NULL": $value = "<<2>>null"; break; } $this->printText("<<3>>{$name} : <<0>>{$value}\n"); } } else { // no user constants $this->printText("No user constants"); } }
/** * Function to get a human readable string from a MAPI error code * *@param int $errcode the MAPI error code, if not given, we use mapi_last_hresult *@return string The defined name for the MAPI error code */ function get_mapi_error_name($errcode = null) { if ($errcode === null) { $errcode = mapi_last_hresult(); } if ($errcode !== 0) { // get_defined_constants(true) is preferred, but crashes PHP // https://bugs.php.net/bug.php?id=61156 $allConstants = get_defined_constants(); foreach ($allConstants as $key => $value) { /** * If PHP encounters a number beyond the bounds of the integer type, * it will be interpreted as a float instead, so when comparing these error codes * we have to manually typecast value to integer, so float will be converted in integer, * but still its out of bound for integer limit so it will be auto adjusted to minus value */ if ($errcode == (int) $value) { // Check that we have an actual MAPI error or warning definition $prefix = substr($key, 0, 7); if ($prefix == "MAPI_E_" || $prefix == "MAPI_W_") { return $key; } } } } else { return "NOERROR"; } // error code not found, return hex value (this is a fix for 64-bit systems, we can't use the dechex() function for this) $result = unpack("H*", pack("N", $errcode)); return "0x" . $result[1]; }
/** * Back compat. with `QUICK_CACHE_` constants. * * @since 150422 Rewrite. */ public static function quickCacheConstants() { if (!($constants = get_defined_constants(true)) || empty($constants['user'])) { return; // Nothing to do; i.e. no user-defined constants. } foreach ($constants['user'] as $_constant => $_value) { if (stripos($_constant, 'QUICK_CACHE_') !== 0) { continue; // Nothing to do here. } if (!($_constant_sub_name = substr($_constant, 12))) { continue; // Nothing to do here. } if (!defined(GLOBAL_NS . '_' . $_constant_sub_name)) { define(GLOBAL_NS . '_' . $_constant_sub_name, $_value); } } unset($_constant, $_value); // Housekeeping. if (isset($_SERVER['QUICK_CACHE_ALLOWED']) && !isset($_SERVER[GLOBAL_NS . '_ALLOWED'])) { $_SERVER[GLOBAL_NS . '_ALLOWED'] = $_SERVER['QUICK_CACHE_ALLOWED']; } }
function osc_theme_slider($params, $content = null) { global $_oscitas_slider, $_oscitas_slider_slides; $index = $_oscitas_slider['current_id']; if (!isset($_oscitas_slider_slides[$index])) { $_oscitas_slider_slides[$index] = array(); } extract(shortcode_atts(array('title' => 'title', 'image' => '', 'caption' => '', 'active' => '', 'slideid' => count($_oscitas_slider_slides[$index])), $params)); $const = get_defined_constants(); if (!empty($image)) { $_oscitas_slider[$index]['bullets'][] = '<li data-target="#oscitas-slider-' . $index . '" data-slide-to="' . $slideid . '" class="' . $active . '"></li>'; $_oscitas_slider_slides[$index][$slideid] = array(); if (!empty($caption)) { $caption = '<p class="ebs-caption">' . $caption . '</p>'; } if (!empty($content)) { $caption = '<p class="ebs-caption">' . $content . '</p>'; } $_oscitas_slider[$index]['details'][] = <<<EOS <div class="item {$active}{$const['EBS_CONTAINER_CLASS']}"> <img src="{$image}" > <div class="carousel-caption{$const['EBS_CONTAINER_CLASS']}"> <h3 class="ebs-caption">{$title}</h3> {$caption} </div> </div> EOS; } }
/** * {@inheritDoc} */ public function getMatches(array $tokens, array $info = array()) { $const = $this->getInput($tokens); return array_filter(array_keys(get_defined_constants()), function ($constant) use($const) { return AbstractMatcher::startsWith($const, $constant); }); }
public function render($file, $data = array()) { // lazy init if (!$this->parser) { include 'Parser.php'; include 'Lexer.php'; include 'Renderer.php'; include 'TemplateDataObject.php'; $renderers = (include 'renderers.php'); $this->parser = new Parser(new Lexer(), new Renderer($renderers, $this)); } if (empty($file)) { throw new \Exception('Template filename is empty.'); } $this->data = new TemplateDataObject($data, \ArrayObject::ARRAY_AS_PROPS); // inject constants into template data $constants = get_defined_constants(true); $constants = $constants['user']; foreach ($constants as $name => $constant) { $this->data[$name] = $constant; } $compiledFile = $this->config['cache_path'] . $file; $sourceFile = $this->config['payload'] . $file; $this->compileFile($sourceFile, $compiledFile); $rendered = $this->exec($compiledFile); // make paths work in subfolder installations // eg. localhost/client/project/index.php //$rendered = str_replace('href="/', 'href="'.APP_ROOT, $rendered); //$rendered = str_replace('src="/', 'src="'.APP_ROOT, $rendered); //$rendered = str_replace('action="/', 'action="'.APP_ROOT, $rendered); // todo: handle protocol-less src's eg. src="//jquery..." return $rendered; }
function setImageFilter($image_f, $f, $hue) { //PARTE DE FILTROS if (!is_numeric($f) && $f != '') { $tmp = get_defined_constants(); $f = $tmp['IMG_FILTER_' . strtoupper($f)]; } //Se um filtro foi escolhido if ($f != '') { $arr = array($image_f, $f); if (isset($_GET['fp1'])) { $arr[] = $_GET['fp1']; } if (isset($_GET['fp2'])) { $arr[] = $_GET['fp2']; } if (isset($_GET['fp3'])) { $arr[] = $_GET['fp3']; } if (isset($_GET['fp4'])) { $arr[] = $_GET['fp4']; } call_user_func_array('imagefilter', $arr); } if ($hue != '') { imagefilterhue($image_f, hexdec(substr($hue, 0, 2)), hexdec(substr($hue, 2, 2)), hexdec(substr($hue, 4, 2))); } }
public static function replaceDefineOnImport($match) { $define = $match[1]; if (defined($define)) { $r = get_defined_constants(); return $r[$define]; } }
/** * Constructor * * @param array Options hash: * - OPT_TAGS_FILE: the path to a tags file produce with ctags for your project -- all tags will be used for autocomplete */ public function __construct($options = array()) { // merge opts $this->options = array_merge(array(self::OPT_TAGS_FILE => NULL, self::OPT_REQUIRE => NULL), $options); // initialize temp files $this->tmpFileShellCommand = $this->tmpFileNamed('command'); $this->tmpFileShellCommandRequires = $this->tmpFileNamed('requires'); $this->tmpFileShellCommandState = $this->tmpFileNamed('state'); // setup autocomplete $phpList = get_defined_functions(); $this->autocompleteList = array_merge($this->autocompleteList, $phpList['internal']); $this->autocompleteList = array_merge($this->autocompleteList, get_defined_constants()); $this->autocompleteList = array_merge($this->autocompleteList, get_declared_classes()); $this->autocompleteList = array_merge($this->autocompleteList, get_declared_interfaces()); // initialize tags $tagsFile = $this->options[self::OPT_TAGS_FILE]; if (file_exists($tagsFile)) { $tags = array(); $tagLines = file($tagsFile); foreach ($tagLines as $tag) { $matches = array(); if (preg_match('/^([A-z0-9][^\\W]*)\\W.*/', $tag, $matches)) { $tags[] = $matches[1]; } } $this->autocompleteList = array_merge($this->autocompleteList, $tags); } // process optional require files if ($this->options[self::OPT_REQUIRE]) { if (!is_array($this->options[self::OPT_REQUIRE])) { $this->options[self::OPT_REQUIRE] = array($this->options[self::OPT_REQUIRE]); } file_put_contents($this->tmpFileShellCommandRequires, serialize($this->options[self::OPT_REQUIRE])); } }
/** * Back compat. with `ZENCACHE_` constants. * * @since 150422 Rewrite. */ public static function zenCacheConstants() { $_global_ns = mb_strtoupper(GLOBAL_NS); if (!($constants = get_defined_constants(true)) || empty($constants['user'])) { return; // Nothing to do; i.e. no user-defined constants. } foreach ($constants['user'] as $_constant => $_value) { if (mb_stripos($_constant, 'ZENCACHE_') !== 0) { continue; // Nothing to do here. } if (!($_constant_sub_name = mb_substr($_constant, 9))) { continue; // Nothing to do here. } if (!defined($_global_ns . '_' . $_constant_sub_name)) { define($_global_ns . '_' . $_constant_sub_name, $_value); } } if (isset($_SERVER['ZENCACHE_ALLOWED']) && !isset($_SERVER[$_global_ns . '_ALLOWED'])) { $_SERVER[$_global_ns . '_ALLOWED'] = $_SERVER['ZENCACHE_ALLOWED']; } unset($_constant, $_value, $_global_ns); // Housekeeping. }
public function execute($session) { $constants = get_defined_constants(); ksort($constants); echo implode(', ', array_keys($constants)) . PHP_EOL; return true; }
/** * Gets content panel for the Debug Bar * * @return string */ public function getPanel() { $this->request = \Zend_Controller_Front::getInstance()->getRequest(); $viewRenderer = \Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); if ($viewRenderer->view && method_exists($viewRenderer->view, 'getVars')) { $viewVars = $this->cleanData($viewRenderer->view->getVars()); } else { $viewVars = "No 'getVars()' method in view class"; } $vars = '<div style="width:50%;float:left;">'; $vars .= '<h4>View variables</h4>' . '<div id="ZFDebug_vars" style="margin-left:-22px">' . $viewVars . '</div>'; $vars .= '</div><div style="width:45%;float:left;">'; $vars .= '<h4>Request parameters</h4>' . '<div id="ZFDebug_requests" style="margin-left:-22px">' . $this->cleanData($this->request->getParams()) . '</div>'; if ($this->request->isPost()) { $vars .= '<h4>Post variables</h4>' . '<div id="ZFDebug_post" style="margin-left:-22px">' . $this->cleanData($this->request->getPost()) . '</div>'; } $vars .= '<h4>Constants</h4>'; $constants = get_defined_constants(true); ksort($constants['user']); $vars .= '<div id="ZFDebug_constants" style="margin-left:-22px">' . $this->cleanData($constants['user']) . '</div>'; $registry = \Zend_Registry::getInstance(); $vars .= '<h4>Zend Registry</h4>'; $registry->ksort(); $vars .= '<div id="ZFDebug_registry" style="margin-left:-22px">' . $this->cleanData($registry) . '</div>'; $cookies = $this->request->getCookie(); $vars .= '<h4>Cookies</h4>' . '<div id="ZFDebug_cookie" style="margin-left:-22px">' . $this->cleanData($cookies) . '</div>'; $vars .= '</div><div style="clear:both"> </div>'; return $vars; }
public function execute() { $this->header('Version'); echo "PHP-", phpversion(), "\n\n"; $this->header('Constants'); $constants = get_defined_constants(); echo "PHP Prefix: ", $constants['PHP_PREFIX'], "\n"; echo "PHP Binary: ", $constants['PHP_BINARY'], "\n"; echo "PHP Default Include path: ", $constants['DEFAULT_INCLUDE_PATH'], "\n"; echo "PHP Include path: ", get_include_path(), "\n"; echo "\n"; // DEFAULT_INCLUDE_PATH // PEAR_INSTALL_DIR // PEAR_EXTENSION_DIR // ZEND_THREAD_SAFE // zend_version $this->header('General Info'); phpinfo(INFO_GENERAL); echo "\n"; $this->header('Extensions'); $extensions = get_loaded_extensions(); $this->logger->info(join(', ', $extensions)); echo "\n"; $this->header('Database Extensions'); foreach (array_filter($extensions, function ($n) { return in_array($n, array('PDO', 'pdo_mysql', 'pdo_pgsql', 'pdo_sqlite', 'pgsql', 'mysqli', 'mysql', 'oci8', 'sqlite3', 'mysqlnd')); }) as $extName) { $this->logger->info($extName, 1); } }
public function dump_userperms() { $constants = get_defined_constants(true); $constants = $constants['user']; echo '<table class="tablesorter">'; echo ' <thead>'; echo ' <tr>'; echo ' <th> Level </th>'; echo ' <th> Bin2Dec </th>'; foreach ($constants as $constant => $val) { if (substr($constant, 0, strlen('ATC_PERMISSION_')) == 'ATC_PERMISSION_') { echo '<th>' . str_replace("_", " ", strtolower(substr($constant, strlen('ATC_PERMISSION_'), 100))) . '</th>'; } } echo ' </tr>'; echo ' </thead>'; echo ' <tbody>'; foreach ($constants as $constant => $val) { if (substr($constant, 0, strlen('ATC_USER_LEVEL_')) == 'ATC_USER_LEVEL_') { echo '<tr>'; echo ' <th>' . str_replace("_", " ", strtolower(substr($constant, strlen('ATC_USER_LEVEL_'), 100))) . '</th>'; echo ' <td>' . $val . '</td>'; foreach ($constants as $perm => $value) { if (substr($perm, 0, strlen('ATC_PERMISSION_')) == 'ATC_PERMISSION_') { echo '<td>'; echo ($val & $value) == $value ? 'X' : ''; echo '</td>'; } } echo '</tr>'; } } echo ' </tbody>'; echo '</table>'; }
function _initialize() { $this->initModel(); $this->site_root = "http://" . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] == 80 ? '' : ':' . $_SERVER['SERVER_PORT']) . __ROOT__ . "/"; $this->assign('site_root', $this->site_root); // 用户权限检查 $this->checkAuthority(); //需要登陆 $admin_info = $_SESSION['admin_info']; $this->role_mod = D("role"); //获取用户角色 $admin_level = $this->role_mod->field('id', 'name')->where('id=' . $_SESSION['admin_info']['role_id'] . '')->find(); $this->assign('admin_level', $admin_level); $this->assign('my_info', $admin_info); // 顶部菜单 $model = M("group"); $top_menu = $model->field('id,title')->where('status=1')->order('sort ASC')->select(); $this->assign('top_menu', $top_menu); //获取网站配置信息 $setting_mod = M('setting'); $setting = $setting_mod->select(); foreach ($setting as $val) { $set[$val['name']] = stripslashes($val['data']); } $this->setting = $set; $this->assign('show_header', true); $this->assign('const', get_defined_constants()); $this->assign('iframe', $_REQUEST['iframe']); $def = array('request' => $_REQUEST); $this->assign('def', json_encode($def)); }
/** * Initialization method */ protected static function init() { $curl_constants = get_defined_constants(true); self::$humanReadableCurlOpts = array_flip($curl_constants['curl']); unset($curl_constants); self::$init = true; }
public function __construct() { $functionDataParser = new PHPBackporter_FunctionDataParser; $this->argHandler = new PHPBackporter_ArgHandler( $functionDataParser->parse(file_get_contents('./function.data')), array( 'define' => array($this, 'handleDefineArg'), 'splAutoloadRegister' => array($this, 'handleSplAutoloadRegisterArg'), 'className' => array($this, 'handleClassNameArg'), 'unsafeClassName' => array($this, 'handleUnsafeClassNameArg'), 'const' => array($this, 'handleConstArg') ) ); $functions = get_defined_functions(); $functions = $functions['internal']; $consts = get_defined_constants(true); unset($consts['user']); $consts = array_keys(call_user_func_array('array_merge', $consts)); $this->internals = array( T_FUNCTION => array_change_key_case(array_fill_keys($functions, true), CASE_LOWER), T_CONST => array_change_key_case(array_fill_keys($consts, true), CASE_LOWER), ); }
/** * * * * **/ public static function getInstance($driver) { if (!(strcasecmp(substr($driver, strlen($driver) - strlen('driver')), 'driver') === 0)) { $driver .= 'Driver'; } if (!file_exists(dirname(__FILE__) . '/Template/' . $driver . '.php')) { $s = new self(); $s->printFatalError($s->lang->translate('No such template driver: [' . $driver . ']')); } self::$_driver = $driver; if (!isset(self::$_drivers[$driver]) || !is_object(self::$_drivers[$driver])) { require dirname(__FILE__) . '/Template/DriverDecorator.php'; require dirname(__FILE__) . '/Template/' . $driver . '.php'; $driver = 'CAT_Helper_Template_' . $driver; self::$_drivers[$driver] = new CAT_Helper_Template_DriverDecorator(new $driver()); self::$_drivers[$driver]->setGlobals(array('CAT_ADMIN_URL' => CAT_ADMIN_URL, 'CAT_URL' => CAT_URL, 'CAT_PATH' => CAT_PATH, 'LEPTON_URL' => CAT_URL, 'CAT_PATH' => CAT_PATH, 'CAT_THEME_URL' => CAT_THEME_URL, 'URL_HELP' => URL_HELP)); $defs = get_defined_constants(true); foreach ($defs['user'] as $const => $value) { if (preg_match('~^DEFAULT_~', $const)) { // DEFAULT_CHARSET etc. self::$_drivers[$driver]->setGlobals($const, $value); continue; } if (preg_match('~^WEBSITE_~', $const)) { // WEBSITE_HEADER etc. self::$_drivers[$driver]->setGlobals($const, $value); continue; } if (preg_match('~^SHOW_~', $const)) { // SHOW_SEARCH etc. self::$_drivers[$driver]->setGlobals($const, $value); continue; } if (preg_match('~^FRONTEND_~', $const)) { // FRONTEND_LOGIN etc. self::$_drivers[$driver]->setGlobals($const, $value); continue; } if (preg_match('~_FORMAT$~', $const)) { // DATE_FORMAT etc. self::$_drivers[$driver]->setGlobals($const, $value); continue; } if (preg_match('~^ENABLE_~', $const)) { // ENABLE_HTMLPURIFIER etc. self::$_drivers[$driver]->setGlobals($const, $value); continue; } } // This is for old language strings global $HEADING, $TEXT, $MESSAGE; foreach (array('TEXT', 'HEADING', 'MESSAGE') as $global) { if (isset(${$global}) && is_array(${$global})) { self::$_drivers[$driver]->setGlobals($global, ${$global}); } } } return self::$_drivers[$driver]; }