本文整理汇总了PHP中DEFINE函数的典型用法代码示例。如果您正苦于以下问题:PHP DEFINE函数的具体用法?PHP DEFINE怎么用?PHP DEFINE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DEFINE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkLogin
function checkLogin()
{
global $mainframe;
DEFINE('GOTOSTARTPAGE_COOKIE', 'ap_gotostartpage');
DEFINE('LOGINPAGELOCATION_COOKIE', 'ap_loginpagelocation');
DEFINE('STARTPAGE_COOKIE', 'ap_startpage');
$gotostartpage = @$_COOKIE[GOTOSTARTPAGE_COOKIE];
if ($gotostartpage) {
setcookie(GOTOSTARTPAGE_COOKIE, 0);
$uri = JFactory::getURI();
$url = $uri->toString();
$loginpagelocation = @$_COOKIE[LOGINPAGELOCATION_COOKIE];
$loginpagelocationuri = new JURI($loginpagelocation);
$query = $loginpagelocationuri->getQuery();
if ($query && strpos($query, 'com_login') === FALSE) {
if ($loginpagelocation && $url != $loginpagelocation) {
$mainframe->redirect($loginpagelocation);
}
} else {
$startpage = @$_COOKIE[STARTPAGE_COOKIE];
if ($startpage && $url != $startpage) {
$mainframe->redirect($startpage);
}
}
}
}
示例2: __construct
/**
* Class constructor to create an instance, takes email and password as arguments
* @param string $email Your google account email
* @param string $password Your google account password
*/
public function __construct($email, $password)
{
$this->email = $email;
$this->password = $password;
date_default_timezone_set("Asia/Taipei");
DEFINE("DEFAULT_MAX_EVENTS", 10000);
}
示例3: __construct
/**
* Class constructor to create an instance, takes email and password as arguments
* @param string $email Your google account email
* @param string $password Your google account password
*/
function __construct($email, $password)
{
$this->email = $email;
$this->password = $password;
date_default_timezone_set("Europe/Stockholm");
DEFINE("DEFAULT_MAX_EVENTS", 25);
}
示例4: RSS
public function RSS($db_connection, $type, $feed_link, $description)
{
DEFINE('LINK', $db_connection);
$this->type = $type;
$this->feed_link = $feed_link;
$this->description = $description;
}
示例5: database_connect
function database_connect()
{
global $obj_db;
// get calendar database
if ($_SERVER["HTTP_HOST"] == 'localhost') {
// local webserver on your computer, like XAMPP
DEFINE('DBHOST', 'localhost');
DEFINE('DBUSER', 'root');
DEFINE('DBPASS', '');
DEFINE('DBNAAM', 'employee-work-schedule');
} else {
// online use, so when you have the calendar on the online website
DEFINE('DBHOST', 'localhost');
DEFINE('DBUSER', 'raman');
DEFINE('DBPASS', 'cPuXtGrNbnP5RTEJac');
DEFINE('DBNAAM', 'work_schedule');
}
$obj_db = mysqli_connect(DBHOST, DBUSER, DBPASS, DBNAAM);
if ($obj_db === FALSE) {
$error = "Database connection failed";
printf("Connect failed: %s\n", mysqli_connect_error());
exit;
}
mysqli_set_charset($obj_db, 'utf8');
}
示例6: persistencia
public static function persistencia($metodo)
{
if ($metodo == 'ARQUIVO') {
DEFINE('PERSISTENCIA', 'Arquivo');
} else {
DEFINE('PERSISTENCIA', 'BD');
}
}
示例7: veritrans_gateway_init
function veritrans_gateway_init()
{
if (!class_exists('WC_Payment_Gateway')) {
return;
}
DEFINE('VT_PLUGIN_DIR', plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__)) . '/');
require_once dirname(__FILE__) . '/class/class.veritrans-gateway.php';
add_filter('woocommerce_payment_gateways', 'add_veritrans_payment_gateway');
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->load->library('encrypt');
//$this->_user_id = $this->session->userdata('user_id');
$this->load->model('home_model', 'home');
DEFINE("FacebookAppID", "1537187986495529");
DEFINE("FacebookAppSecret", '41b16d06e17a8171ba44da9d7c480402');
}
示例9: onAfterInitialise
function onAfterInitialise()
{
$mainframe =& JFactory::getApplication();
// register our autoloader
$this->_registerAutoloader();
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_sh404sef' . DS . 'sh404sef.class.php';
// for now we declare sefConfig as global, as this would break
//too many 3rd party plugins if otherwise
// TODO : update doc so that new plugins use new method to get config
global $sefConfig;
$sefConfig =& shRouter::shGetConfig();
if (!$mainframe->isAdmin() && $sefConfig->shSecEnableSecurity) {
require_once JPATH_ROOT . DS . 'components' . DS . 'com_sh404sef' . DS . 'shSec.php';
// do security checks
shDoSecurityChecks();
shCleanUpSecLogFiles();
// see setting in class file for clean up frequency
}
if (!$sefConfig->Enabled) {
// go away if not enabled
return;
}
DEFINE('SH404SEF_IS_RUNNING', 1);
if (!$mainframe->isAdmin()) {
// setup our JPagination replacement, so as to bring
// back # of items per page in the url, in order
// to properly calculate pagination
// will only work if php > 5, so test for that
if (version_compare(phpversion(), '5.0') >= 0) {
// this register the old file, but do not load it if PHP5
// will prevent further calls to the same jimport()
// to actually do anything, because the 'joomla.html.pagination' key
// is now registered statically in Jloader::import()
jimport('joomla.html.pagination');
// now we can register our own path
JLoader::register('JPagination', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_sh404sef' . DS . 'pagination.php');
}
// include more sh404SEF stuff
require_once JPATH_ROOT . DS . 'components' . DS . 'com_sh404sef' . DS . 'shCache.php';
// override router class with our :
$previousRouter =& $mainframe->getRouter();
// create an instance of our class
$shRouter = new shRouter();
// store the previous router
$shRouter->jRouter = clone $previousRouter;
// make sure the cloned Joomla router is activated
$shRouter->jRouter->setMode(JROUTER_MODE_SEF);
// then override
$previousRouter = $shRouter;
// load plugins, as per configuration
$this->_loadPlugins($type = 'sh404sefcore');
// start decoding URL + decide possible redirects
include JPATH_ROOT . DS . 'components' . DS . 'com_sh404sef' . DS . 'shInit.php';
}
}
示例10: RSS
public function RSS()
{
require 'database.php';
DEFINE('DB_USER', $_username);
DEFINE('DB_PASSWORD', $_password);
DEFINE('DB_HOST', $_host);
DEFINE('DB_NAME', $_db);
// Make the connnection and then select the database.
$dbc = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Could not connect to MySQL: ' . mysql_error());
mysql_select_db(DB_NAME) or die('Could not select the database: ' . mysql_error());
}
示例11: __construct
/**
* Constructor
*/
function __construct($config = array())
{
$db = JFactory::getDBO();
$sql = " SELECT COUNT(id) as count " . " FROM #__clm_liga " . " WHERE sl = " . clm_core::$access->getJid() . " AND rang <> 0";
$db->setQuery($sql);
$count_sl = $db->loadObjectList();
DEFINE('CLM_sl_count', $count_sl[0]->count);
parent::__construct($config);
// Register Extra tasks
$this->registerTask('add', 'edit');
$this->registerTask('apply', 'save');
$this->registerTask('unpublish', 'publish');
}
示例12: __construct
public function __construct($data = null, $id = null, $width = 600, $height = 400)
{
if (!self::Installed()) {
throw new Exception('JPGraph isn\'t installed. Call EGSGantt::Installed() before instantiating!');
}
if (!defined('TTF_DIR')) {
DEFINE('TTF_DIR', '/usr/share/fonts/truetype/msttcorefonts/');
}
require_once APP_ROOT . 'plugins/jpgraph/jpgraph.php';
if ($id == null) {
$id = time();
}
$this->id = $id;
}
示例13: jr_mt_wp_get_themes_fix
function jr_mt_wp_get_themes_fix()
{
DEFINE('JR_MT_WP_GET_THEMES_WORKS', TRUE);
/* Force the next request for Stylesheet or Template
to process the Theme Selection logic,
even if previous requests have cached the Theme.
*/
unset($GLOBALS['jr_mt_theme']);
if (is_admin()) {
global $jr_mt_all_themes_cache;
$jr_mt_all_themes_cache = wp_get_themes();
update_option('jr_mt_all_themes', $jr_mt_all_themes_cache);
}
}
示例14: authenticate
/**
*
* Method to authenticate the user via the database
* @param string $username The username supplied in the login
* @param string $password The password supplied in the login
* @return TRUE|FALSE Boolean indication of success of login
*/
public function authenticate($username, $password, $remember = true)
{
$login = $this->objLu->login($username, $password, $remember);
if (!$login) {
// check if user is inactive
if ($this->objLu->isInactive()) {
throw new customException("User is inactive, please contact site admin");
} else {
return FALSE;
}
}
//Retrieve the users data from the database
$line = $this->getUserDataAsArray($username);
// set the line as a stdClass, serialize and store in session to lower db calls
$user = new stdClass();
// add the user info to the class
$user->username = $line['username'];
$user->userid = $line['userid'];
$user->title = $line['title'];
$user->firstname = $line['firstname'];
$user->surname = $line['surname'];
$user->pass = NULL;
$user->creationdate = $line['creationdate'];
$user->emailaddress = $line['emailaddress'];
$user->logins = $line['logins'];
$user->isactive = $line['isactive'];
// serialize the object to preserve structure etc
$user = serialize($user);
// set it into session to be used elsewhere (objUser mainly)
$this->setSession('userprincipal', $user);
if ($line) {
if ($line['isactive'] == '0') {
DEFINE('STATUS', 'inactive');
return FALSE;
}
//LDAP will be handled in chain-of-command
if ($line['pass'] == sha1('--LDAP--')) {
return FALSE;
} else {
$password = sha1(trim($password));
// if the login was successful
if ($this->objLu->isloggedIn() == TRUE) {
//if ( strtolower($line['pass'])==strtolower($password) ) {
$this->_record = $line;
return TRUE;
}
}
}
return FALSE;
}
示例15: __construct
public function __construct(Request $request)
{
$segments = $request->segments();
$locales = LaravelLocalization::getSupportedLanguagesKeys();
$non_locale_route = '';
$lang = App::getLocale();
foreach ($segments as $segment) {
if (!in_array($segment, $locales)) {
$non_locale_route .= '/' . $segment;
}
}
DEFINED('NON_LOCALE_ROUTE') or DEFINE('NON_LOCALE_ROUTE', trim($non_locale_route, '/'));
DEFINED('LANG') or DEFINE('LANG', $lang);
}