本文整理汇总了PHP中define函数的典型用法代码示例。如果您正苦于以下问题:PHP define函数的具体用法?PHP define怎么用?PHP define使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了define函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getdata
function getdata($style, $parameter)
{
$array = array();
foreach ($parameter as $key => $value) {
if (is_array($value)) {
$parameter[$key] = implode(',', $value);
}
}
$parameter['clientid'] = $this->blockdata['clientid'];
$parameter['op'] = 'getdata';
$parameter['charset'] = CHARSET;
$parameter['version'] = $this->blockdata['version'];
$xmlurl = $this->blockdata['url'];
$parse = parse_url($xmlurl);
if (!empty($parse['host'])) {
define('IN_ADMINCP', true);
require_once libfile('function/importdata');
$importtxt = @dfsockopen($xmlurl, 0, create_sign_url($parameter, $this->blockdata['key'], $this->blockdata['signtype']));
} else {
$importtxt = @file_get_contents($xmlurl);
}
if ($importtxt) {
require libfile('class/xml');
$array = xml2array($importtxt);
}
$idtype = 'xml_' . $this->blockdata['id'];
foreach ($array['data'] as $key => $value) {
$value['idtype'] = $idtype;
$array['data'][$key] = $value;
}
if (empty($array['data'])) {
$array['data'] = null;
}
return $array;
}
示例2: __construct
/**
* Constructor
*
* @access public
* @param object ipsRegistry reference
* @param array Configuration info for this method
* @param array Custom configuration info for this method
* @return void
*/
public function __construct(ipsRegistry $registry, $method, $conf = array())
{
$this->method_config = $method;
$this->openid_config = $conf;
parent::__construct($registry);
//-----------------------------------------
// Fix include path for OpenID libs
//-----------------------------------------
$path_extra = dirname(__FILE__);
$path = ini_get('include_path');
$path = $path_extra . PATH_SEPARATOR . $path;
ini_set('include_path', $path);
define('Auth_OpenID_RAND_SOURCE', null);
//-----------------------------------------
// OpenID libraries are not STRICT compliant
//-----------------------------------------
ob_start();
/**
* Turn off strict error reporting for openid
*/
if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_RECOVERABLE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
} else {
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_USER_ERROR | E_USER_WARNING);
}
//-----------------------------------------
// And grab libs
//-----------------------------------------
require_once "Auth/OpenID/Consumer.php";
require_once "Auth/OpenID/FileStore.php";
require_once "Auth/OpenID/SReg.php";
require_once "Auth/OpenID/PAPE.php";
}
示例3: apiUpdateOrder
public static function apiUpdateOrder($order, $response)
{
if (!defined('ORDER_MANAGEMENT')) {
define('ORDER_MANAGEMENT', true);
}
if (!empty($order['status'])) {
$statuses = fn_get_statuses(STATUSES_ORDER, false, true);
if (!isset($statuses[$order['status']])) {
$response->addError('ERROR_OBJECT_UPDATE', str_replace('[object]', 'orders', __('twgadmin_wrong_api_object_data')));
} else {
fn_change_order_status($order['order_id'], $order['status']);
}
}
$cart = array();
fn_clear_cart($cart, true);
$customer_auth = fn_fill_auth(array(), array(), false, 'C');
fn_form_cart($order['order_id'], $cart, $customer_auth);
$cart['order_id'] = $order['order_id'];
// update only profile data
$profile_data = fn_check_table_fields($order, 'user_profiles');
$cart['user_data'] = fn_array_merge($cart['user_data'], $profile_data);
$cart['user_data'] = fn_array_merge($cart['user_data'], $order);
fn_calculate_cart_content($cart, $customer_auth, 'A', true, 'I');
if (!empty($order['details'])) {
db_query('UPDATE ?:orders SET details = ?s WHERE order_id = ?i', $order['details'], $order['order_id']);
}
if (!empty($order['notes'])) {
$cart['notes'] = $order['notes'];
}
fn_update_payment_surcharge($cart, $customer_auth);
list($order_id, $process_payment) = fn_place_order($cart, $customer_auth, 'save');
return array($order_id, $process_payment);
}
示例4: sendPushNotificationToGCM
function sendPushNotificationToGCM($registration_ids, $message)
{
$GCM_SERVER_API_KEY = $_ENV["GCM_SERVER_API_KEY"];
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array('registration_ids' => $registration_ids, 'data' => $message);
// Update your Google Cloud Messaging API Key
if (!defined('GOOGLE_API_KEY')) {
define("GOOGLE_API_KEY", $GCM_SERVER_API_KEY);
}
$headers = array('Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);
return $result;
}
示例5: addUserFacebook
/**
* Add facebook user
*/
public function addUserFacebook($aVals, $iFacebookUserId, $sAccessToken)
{
if (!defined('PHPFOX_IS_FB_USER')) {
define('PHPFOX_IS_FB_USER', true);
}
//get facebook setting
$bFbConnect = Phpfox::getParam('facebook.enable_facebook_connect');
if ($bFbConnect == false) {
return false;
} else {
if (Phpfox::getService('accountapi.facebook')->checkUserFacebook($iFacebookUserId) == false) {
if (Phpfox::getParam('user.disable_username_on_sign_up')) {
$aVals['user_name'] = Phpfox::getLib('parse.input')->cleanTitle($aVals['full_name']);
}
$aVals['country_iso'] = null;
if (Phpfox::getParam('user.split_full_name')) {
$aNameSplit = preg_split('[ ]', $aVals['full_name']);
$aVals['first_name'] = $aNameSplit[0];
unset($aNameSplit[0]);
$aVals['last_name'] = implode(' ', $aNameSplit);
}
$iUserId = Phpfox::getService('user.process')->add($aVals);
if ($iUserId === false) {
return false;
} else {
Phpfox::getService('facebook.process')->addUser($iUserId, $iFacebookUserId);
//update fb profile image to db
$bCheck = Phpfox::getService('accountapi.facebook')->addImagePicture($sAccessToken, $iUserId);
}
}
}
return true;
}
示例6: execute
/**
* Perform installation.
*/
function execute()
{
define('RUNNING_UPGRADE', 1);
$templateMgr = TemplateManager::getManager($this->_request);
$installer = new Upgrade($this->_data);
// FIXME Use logger?
// FIXME Mostly common with InstallForm
if ($installer->execute()) {
if (!$installer->wroteConfig()) {
// Display config file contents for manual replacement
$templateMgr->assign(array('writeConfigFailed' => true, 'configFileContents' => $installer->getConfigContents()));
}
$templateMgr->assign('notes', $installer->getNotes());
$templateMgr->assign('newVersion', $installer->getNewVersion());
$templateMgr->display('install/upgradeComplete.tpl');
} else {
switch ($installer->getErrorType()) {
case INSTALLER_ERROR_DB:
$this->dbInstallError($installer->getErrorMsg());
break;
default:
$this->installError($installer->getErrorMsg());
break;
}
}
$installer->destroy();
}
示例7: cherry_plugin_settings
function cherry_plugin_settings()
{
global $wpdb;
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$upload_dir = wp_upload_dir();
$plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'cherry-plugin.php');
//Cherry plugin constant variables
define('CHERRY_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('CHERRY_PLUGIN_URL', plugin_dir_url(__FILE__));
define('CHERRY_PLUGIN_DOMAIN', $plugin_data['TextDomain']);
define('CHERRY_PLUGIN_DOMAIN_DIR', $plugin_data['DomainPath']);
define('CHERRY_PLUGIN_VERSION', $plugin_data['Version']);
define('CHERRY_PLUGIN_NAME', $plugin_data['Name']);
define('CHERRY_PLUGIN_SLUG', plugin_basename(__FILE__));
define('CHERRY_PLUGIN_DB', $wpdb->prefix . CHERRY_PLUGIN_DOMAIN);
define('CHERRY_PLUGIN_REMOTE_SERVER', esc_url('http://tmbhtest.com/cherryframework.com/components_update/'));
//Other constant variables
define('CURRENT_THEME_DIR', get_stylesheet_directory());
define('CURRENT_THEME_URI', get_stylesheet_directory_uri());
define('UPLOAD_BASE_DIR', str_replace("\\", "/", $upload_dir['basedir']));
define('UPLOAD_DIR', str_replace("\\", "/", $upload_dir['path'] . '/'));
// if ( !defined('API_URL') ) {
// define( 'API_URL', esc_url( 'http://updates.cherry.template-help.com/cherrymoto/v3/api/' ) );
// }
load_plugin_textdomain(CHERRY_PLUGIN_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/' . CHERRY_PLUGIN_DOMAIN_DIR);
do_action('cherry_plugin_settings');
}
示例8: __construct
public function __construct()
{
define('job_bm_plugin_url', WP_PLUGIN_URL . '/' . plugin_basename(dirname(__FILE__)) . '/');
define('job_bm_plugin_dir', plugin_dir_path(__FILE__));
define('job_bm_wp_url', 'https://wordpress.org/plugins/job-board-manager/');
define('job_bm_wp_reviews', 'http://wordpress.org/support/view/plugin-reviews/job-board-manager');
define('job_bm_pro_url', 'http://www.pickplugins.com/item/job-board-manager-create-job-site-for-wordpress/');
define('job_bm_demo_url', 'www.pickplugins.com/demo/job-board-manager/');
define('job_bm_conatct_url', 'http://www.pickplugins.com/contact/');
define('job_bm_qa_url', 'http://www.pickplugins.com/questions/');
define('job_bm_plugin_name', 'Job Board Manager');
define('job_bm_plugin_version', '1.0.11');
define('job_bm_customer_type', 'free');
// pro & free
define('job_bm_share_url', 'https://wordpress.org/plugins/job-board-manager/');
define('job_bm_tutorial_video_url', '//www.youtube.com/embed/Z-ZzJiyVNJ4?rel=0');
// Class
require_once plugin_dir_path(__FILE__) . 'includes/class-post-types.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-post-meta.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-shortcodes.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-functions.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-settings.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-emails.php';
//Front-end Forms Input Class
require_once plugin_dir_path(__FILE__) . 'includes/class-frontend-forms-input.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-frontend-form-edit-job.php';
require_once plugin_dir_path(__FILE__) . 'includes/class-frontend-form-new-job.php';
require_once plugin_dir_path(__FILE__) . 'includes/ajax-upload.php';
// Function's
require_once plugin_dir_path(__FILE__) . 'includes/functions.php';
add_action('admin_enqueue_scripts', 'wp_enqueue_media');
add_action('wp_enqueue_scripts', array($this, 'job_bm_front_scripts'));
add_action('admin_enqueue_scripts', array($this, 'job_bm_admin_scripts'));
}
示例9: initForm
function initForm()
{
global $db, $cp, $spconfig;
$do = $cp->getParam('do');
// Cache Phrases
$this->phrase = $cp->getPhrases("userIndex");
$cp->header();
switch ($_REQUEST['do']) {
case 'add':
$this->addAnnouncementForm();
break;
case 'add_confirm':
$this->addAnnouncementCommit();
break;
case 'edit':
$this->editAnnouncementForm();
break;
case 'edit_confirm':
$this->editAnnouncementCommit();
break;
case 'delete':
$this->deleteAnnouncementCommit();
break;
default:
define('SUPPORTID', 'CPHOME');
$this->mainForm();
break;
}
$cp->footer();
}
示例10: nocache
/**
* Set nocache constants and headers.
*
* @access private
* @return void
*/
private function nocache()
{
if (!defined('DONOTCACHEPAGE')) {
define("DONOTCACHEPAGE", "true");
}
nocache_headers();
}
示例11: GPC
function GPC()
{
if (!defined('str')) {
define('str', 2);
}
if (!defined('int')) {
define('int', 1);
}
if (!defined('arr_str')) {
define('arr_str', 5);
}
if (!defined('arr_int')) {
define('arr_int', 4);
}
if (!defined('none')) {
define('none', 0);
}
if (!defined('arr_none')) {
define('arr_none', 3);
}
if (!defined('db_esc')) {
define('db_esc', 6);
}
if (!defined('html_enc')) {
define('html_enc', 7);
}
if (!defined('path')) {
define('path', 8);
}
$this->prepare_original = array('"', "'", '<', '>');
$this->prepare_entity = array('"', ''', '<', '>');
$this->php523 = version_compare(PHP_VERSION, '5.2.3', '>=');
}
示例12: __construct
/**
* Class constructor
*/
public function __construct()
{
self::setconfig();
define('M', $this->_m);
define('F', $this->_f);
define('V', $this->_v);
}
示例13: createPDF
/**
* @param ContainerInterface $container
* @param $options
* @return DOMPDF
*/
public function createPDF(ContainerInterface $container, $options)
{
if (defined('DOMPDF_DIR') === false) {
define("DOMPDF_DIR", __DIR__ . '/../../../../../../dompdf/dompdf');
}
if (defined('DOMPDF_INC_DIR') === false) {
define("DOMPDF_INC_DIR", DOMPDF_DIR . "/include");
}
if (defined('DOMPDF_LIB_DIR') === false) {
define("DOMPDF_LIB_DIR", DOMPDF_DIR . "/lib");
}
if (defined('DOMPDF_AUTOLOAD_PREPEND') === false) {
define("DOMPDF_AUTOLOAD_PREPEND", false);
}
if (defined('DOMPDF_ADMIN_USERNAME') === false) {
define("DOMPDF_ADMIN_USERNAME", false);
}
if (defined('DOMPDF_ADMIN_PASSWORD') === false) {
define("DOMPDF_ADMIN_PASSWORD", false);
}
foreach ($options as $key => $value) {
if (!array_key_exists($key, static::$configCompatMapping)) {
continue;
}
if (defined(static::$configCompatMapping[$key])) {
continue;
}
define(static::$configCompatMapping[$key], $value);
}
require_once DOMPDF_LIB_DIR . '/html5lib/Parser.php';
require_once DOMPDF_INC_DIR . '/functions.inc.php';
return new DOMPDF();
}
示例14: define_constants
/**
* Define Meta Slider constants
*/
private function define_constants()
{
define('METASLIDER_VERSION', $this->version);
define('METASLIDER_BASE_URL', trailingslashit(plugins_url('ml-slider')));
define('METASLIDER_ASSETS_URL', trailingslashit(METASLIDER_BASE_URL . 'assets'));
define('METASLIDER_PATH', plugin_dir_path(__FILE__));
}
示例15: constants
function constants($options)
{
define("THEME_DIR", get_template_directory());
define("THEME_DIR_URI", get_template_directory_uri());
define("THEME_NAME", $options["theme_name"]);
if (defined("ICL_LANGUAGE_CODE")) {
$lang = "_" . ICL_LANGUAGE_CODE;
} else {
$lang = "";
}
define("THEME_OPTIONS", $options["theme_name"] . '_options' . $lang);
define("THEME_SLUG", $options["theme_slug"]);
define("THEME_STYLES", THEME_DIR_URI . "/stylesheet/css");
define("THEME_IMAGES", THEME_DIR_URI . "/images");
define("THEME_JS", THEME_DIR_URI . "/js");
define('FONTFACE_DIR', THEME_DIR . '/fontface');
define('FONTFACE_URI', THEME_DIR_URI . '/fontface');
define("THEME_FRAMEWORK", THEME_DIR . "/framework");
define("THEME_PLUGINS", THEME_FRAMEWORK . "/plugins");
define("THEME_ACTIONS", THEME_FRAMEWORK . "/actions");
define("THEME_PLUGINS_URI", THEME_DIR_URI . "/framework/plugins");
define("THEME_SHORTCODES", THEME_FRAMEWORK . "/shortcodes");
define("THEME_WIDGETS", THEME_FRAMEWORK . "/widgets");
define("THEME_SLIDERS", THEME_FRAMEWORK . "/sliders");
define("THEME_HELPERS", THEME_FRAMEWORK . "/helpers");
define("THEME_FUNCTIONS", THEME_FRAMEWORK . "/functions");
define("THEME_CLASSES", THEME_FRAMEWORK . "/classes");
define('THEME_ADMIN', THEME_FRAMEWORK . '/admin');
define('THEME_METABOXES', THEME_ADMIN . '/metaboxes');
define('THEME_ADMIN_POST_TYPES', THEME_ADMIN . '/post-types');
define('THEME_GENERATORS', THEME_ADMIN . '/generators');
define('THEME_ADMIN_URI', THEME_DIR_URI . '/framework/admin');
define('THEME_ADMIN_ASSETS_URI', THEME_DIR_URI . '/framework/admin/assets');
}