本文整理汇总了PHP中MAX类的典型用法代码示例。如果您正苦于以下问题:PHP MAX类的具体用法?PHP MAX怎么用?PHP MAX使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MAX类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getControllerClass
function _getControllerClass($controllerType = '', $aParams = null, &$class, &$file)
{
if (!is_array($aParams)) {
$aParams = array();
}
if (empty($controllerType) || $controllerType == '-') {
$controllerType = basename($_SERVER['SCRIPT_NAME']);
$controllerType = preg_replace('#^(?:stats-)?(.*)\\.php#', '$1', $controllerType);
}
// Validate
if (!preg_match('/^[a-z-]+$/Di', $controllerType)) {
$errMsg = "OA_Admin_Statistics_Factory::_getControllerClass() Unsupported controller type";
return MAX::raiseError($errMsg, MAX_ERROR_INVALIDARGS, PEAR_ERROR_RETURN);
}
// Prepare the strings required to generate the file and class names
list($primary, $secondary) = explode('-', $controllerType, 2);
$primary = ucfirst(strtolower($primary));
$aSecondary = explode('-', $secondary);
foreach ($aSecondary as $key => $string) {
$aSecondary[$key] = ucfirst(strtolower($string));
}
$file = MAX_PATH . '/lib/OA/Admin/Statistics/Delivery/Controller/';
$file .= $primary;
foreach ($aSecondary as $string) {
$file .= $string;
}
$file .= '.php';
$class = 'OA_Admin_Statistics_Delivery_Controller_';
$class .= $primary;
foreach ($aSecondary as $string) {
$class .= $string;
}
}
示例2: processBucket
/**
* Process an aggregate-type bucket. This is MySQL specific.
*
* @param Plugins_DeliveryLog $oBucket a reference to the using (context) object.
* @param Date $oEnd A PEAR_Date instance, interval_start to process up to (inclusive).
*/
public function processBucket($oBucket, $oEnd)
{
$sTableName = $oBucket->getBucketTableName();
$oMainDbh =& OA_DB_Distributed::singleton();
if (PEAR::isError($oMainDbh)) {
MAX::raiseError($oMainDbh, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
OA::debug(' - Processing the ' . $sTableName . ' table for data with operation interval start equal to or before ' . $oEnd->format('%Y-%m-%d %H:%M:%S') . ' ' . $oEnd->tz->getShortName(), PEAR_LOG_INFO);
// Select all rows with interval_start <= previous OI start.
$rsData =& $this->getBucketTableContent($sTableName, $oEnd);
$rowCount = $rsData->getRowCount();
OA::debug(' - ' . $rsData->getRowCount() . ' records found', PEAR_LOG_DEBUG);
if ($rowCount) {
// We can't do bulk inserts with ON DUPLICATE.
$aExecQueries = array();
while ($rsData->fetch()) {
// Get first row
$aRow = $rsData->toArray();
// Insert or update
$aExecQueries[] = "SELECT bucket_update_{$sTableName}(" . join(',', array_map(array(&$oMainDbh, 'quote'), $aRow)) . ")";
}
if (count($aExecQueries)) {
foreach ($aExecQueries as $execQuery) {
$result = $oMainDbh->exec($execQuery);
if (PEAR::isError($result)) {
MAX::raiseError($result, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
}
}
}
}
示例3: init
function init($templateName)
{
$this->template_dir = MAX_PATH . '/lib/templates/admin';
$this->compile_dir = MAX_PATH . '/var/templates_compiled';
$this->cache_dir = MAX_PATH . '/var/cache';
$this->caching = 0;
$this->cache_lifetime = 3600;
$this->register_function('t', array('OA_Admin_Template', '_function_t'));
$this->register_function('tabindex', array('OA_Admin_Template', '_function_tabindex'));
$this->register_function('oa_icon', array('OA_Admin_Template', '_function_oa_icon'));
$this->register_function('oa_title_sort', array('OA_Admin_Template', '_function_oa_title_sort'));
$this->register_function('ox_column_title', array('OA_Admin_Template', '_function_ox_column_title'));
$this->register_function('ox_column_class', array('OA_Admin_Template', '_function_ox_column_class'));
$this->register_function('ox_campaign_type', array('OA_Admin_Template', '_function_ox_campaign_type'));
$this->register_function('ox_campaign_status', array('OA_Admin_Template', '_function_ox_campaign_status'));
$this->register_function('ox_campaign_icon', array('OA_Admin_Template', '_function_ox_campaign_icon'));
$this->register_function('ox_banner_size', array('OA_Admin_Template', '_function_ox_banner_size'));
$this->register_function('ox_banner_icon', array('OA_Admin_Template', '_function_ox_banner_icon'));
$this->register_function('ox_zone_size', array('OA_Admin_Template', '_function_ox_zone_size'));
$this->register_function('ox_zone_icon', array('OA_Admin_Template', '_function_ox_zone_icon'));
$this->register_function('ox_tracker_type', array('OA_Admin_Template', '_function_ox_tracker_type'));
$this->register_function('ox_entity_id', array('OA_Admin_Template', '_function_ox_entity_id'));
$this->register_function('boldSearchPhrase', array('OA_Admin_Template', '_function_boldSearchPhrase'));
$this->register_function('oa_is_admin', array('OA_Admin_Template', '_function_oa_is_admin'));
$this->register_function('oa_is_manager', array('OA_Admin_Template', '_function_oa_is_manager'));
$this->register_function('oa_is_advertiser', array('OA_Admin_Template', '_function_oa_is_advertiser'));
$this->register_function('oa_is_trafficker', array('OA_Admin_Template', '_function_oa_is_trafficker'));
$this->register_function('phpAds_ShowBreak', array('OA_Admin_Template', '_function_phpAds_ShowBreak'));
$this->register_function('phpAds_DelConfirm', array('OA_Admin_Template', '_function_phpAds_DelConfirm'));
$this->register_function('MAX_zoneDelConfirm', array('OA_Admin_Template', '_function_MAX_zoneDelConfirm'));
$this->register_function('showStatusText', array('OA_Admin_Template', '_function_showStatusText'));
$this->register_function('showCampaignType', array('OA_Admin_Template', '_function_showCampaignType'));
$this->register_function('oa_form_input_attributes', array('OA_Admin_Template', '_function_form_input_attributes'));
$this->register_block('oa_edit', array('OA_Admin_Template', '_block_edit'));
$this->register_block('oa_form_element', array('OA_Admin_Template', '_block_form_element'));
$this->templateName = $templateName;
$this->assign('phpAds_TextDirection', $GLOBALS['phpAds_TextDirection']);
$this->assign('phpAds_TextAlignLeft', $GLOBALS['phpAds_TextAlignLeft']);
$this->assign('phpAds_TextAlignRight', $GLOBALS['phpAds_TextAlignRight']);
$this->assign('assetPath', OX::assetPath());
$this->assign("adminWebPath", MAX::constructURL(MAX_URL_ADMIN, ''));
$this->assign("oaTemplateDir", MAX_PATH . '/lib/templates/admin/');
//for pluggable page elements
//- plugins may need to refrence their JS in OXP page templates
$this->assign("adminPluginWebPath", MAX::constructURL(MAX_URL_ADMIN, 'plugins'));
//- plugins may need to inject their own
//template based elements into normal templates
$this->assign("pluginBaseDir", MAX_PATH . '/www/admin/plugins/');
$this->assign("pluginTemplateDir", '/templates/');
/**
* CVE-2013-5954
*
* Register the helper method to allow the the required session token to
* be placed into GET method calls for CRUD operations in templates. See
* OA_Permission::checkSessionToken() method for details.
*/
$this->register_function('rv_add_session_token', array('OA_Admin_Template', '_add_session_token'));
}
示例4: display
/**
* A method to launch and display the widget
*
*/
function display()
{
$oTpl = new OA_Admin_Template('dashboard/grid.html');
$oTpl->assign('dashboardURL', MAX::constructURL(MAX_URL_ADMIN, 'dashboard.php'));
$oTpl->assign('cssURL', OX::assetPath() . "/css");
$oTpl->assign('imageURL', OX::assetPath() . "/images");
$oTpl->assign('jsURL', OX::assetPath() . "/js");
$oTpl->display();
}
示例5: belongsToAccount
/**
* The belongsToAccount() method behaves in a different way when looking
* at entries in the "audit" table. To check if an account has access
* to view specific audit data, we only need to check if the account's
* ID is set in the appropriate column in the record.
*
* @param string $accountId The account ID to test if this DB_DataObject is
* owned by.
* @return boolean|null Returns true if the entity belongs to the specified
* account, false if doesn't, or null if it was not
* possible to find the required object references.
*/
function belongsToAccount($accountId = null)
{
// Set the account ID, if not passed in
if (empty($accountId)) {
$accountId = OA_Permission::getAccountId();
}
// Prepare $this with the required info of the "entity" to be tested
if (!$this->N) {
$key = $this->getFirstPrimaryKey();
if (empty($this->{$key})) {
MAX::raiseError('Key on object is not set, table: ' . $this->getTableWithoutPrefix());
return null;
}
if (!$this->find($autoFetch = true)) {
return null;
}
}
// Test the account ID type, and then test for access
$accountType = OA_Permission::getAccountTypeByAccountId($accountId);
// Test the access to the audit trail entry
if ($accountType == OA_ACCOUNT_ADMIN) {
// Admin always has access
return true;
} else {
if ($accountType == OA_ACCOUNT_MANAGER) {
// Test if the account ID is equal to the account_id field
if (is_null($this->account_id)) {
return null;
}
if ($this->account_id == $accountId) {
return true;
}
} else {
if ($accountType == OA_ACCOUNT_ADVERTISER) {
// Test if the account ID is equal to the advertiser_account_id field
if (is_null($this->advertiser_account_id)) {
return null;
}
if ($this->advertiser_account_id == $accountId) {
return true;
}
} else {
if ($accountType == OA_ACCOUNT_TRAFFICKER) {
// Test if the account ID is equal to the website_account_id field
if (is_null($this->website_account_id)) {
return null;
}
if ($this->website_account_id == $accountId) {
return true;
}
}
}
}
}
return false;
}
示例6: test_constructURL_Includes_Nonstandard_Secure_Port_Number
function test_constructURL_Includes_Nonstandard_Secure_Port_Number()
{
$http = $GLOBALS['_MAX']['HTTP'];
$GLOBALS['_MAX']['HTTP'] = 'https://';
$_SERVER['SERVER_PORT'] = 4430;
$GLOBALS['_MAX']['CONF']['openads']['sslPort'] = 4430;
$url = MAX::constructURL(MAX_URL_ADMIN, 'test.html');
$this->assertEqual($url, 'https://www.maxstore.net:4430/www/admin/test.html', "A non-standard port number should be explicitly provided in delivery URLs. %s");
$GLOBALS['_MAX']['HTTP'] = $http;
}
示例7: processBucket
/**
* Process a raw-type bucket.
*
* @param Plugins_DeliveryLog a reference to the using (context) object.
* @param Date $oEnd A PEAR_Date instance, interval_start to process up to (inclusive).
*/
public function processBucket($oBucket, $oEnd)
{
$sTableName = $oBucket->getBucketTableName();
$oMainDbh =& OA_DB_Distributed::singleton();
if (PEAR::isError($oMainDbh)) {
MAX::raiseError($oMainDbh, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
OA::debug(' - Processing the ' . $sTableName . ' table for data with operation interval start equal to or before ' . $oEnd->format('%Y-%m-%d %H:%M:%S') . ' ' . $oEnd->tz->getShortName(), PEAR_LOG_INFO);
// As this is raw data being processed, data will not be logged based on the operation interval,
// but based on the time the raw data was collected. Adjust the $oEnd value accordingly...
$aDates = OX_OperationInterval::convertDateToOperationIntervalStartAndEndDates($oEnd);
OA::debug(' - The ' . $sTableName . ' table is a raw data table. Data logged in real-time, not operation intervals.', PEAR_LOG_INFO);
OA::debug(' - Accordingly, processing of the ' . $sTableName . ' table will be performed based on data that has a logged date equal to', PEAR_LOG_INFO);
OA::debug(' or before ' . $aDates['end']->format('%Y-%m-%d %H:%M:%S') . ' ' . $aDates['end']->tz->getShortName(), PEAR_LOG_INFO);
// Select all rows with interval_start <= previous OI start.
$rsData =& $this->getBucketTableContent($sTableName, $aDates['end']);
$count = $rsData->getRowCount();
OA::debug(' - ' . $rsData->getRowCount() . ' records found', PEAR_LOG_DEBUG);
if ($count) {
$packetSize = 16777216;
// 16 MB hardcoded (there's no max limit)
$i = 0;
while ($rsData->fetch()) {
$aRow = $rsData->toArray();
$sRow = '(' . join(',', array_map(array(&$oMainDbh, 'quote'), $aRow)) . ')';
if (!$i) {
$sInsert = "INSERT INTO {$sTableName} (" . join(',', array_keys($aRow)) . ") VALUES ";
$query = '';
$aExecQueries = array();
}
if (!$query) {
$query = $sInsert . $sRow;
// Leave 4 bytes headroom for max_allowed_packet
} elseif (strlen($query) + strlen($sRow) + 4 < $packetSize) {
$query .= ',' . $sRow;
} else {
$aExecQueries[] = $query;
$query = $sInsert . $sRow;
}
if (++$i >= $count || strlen($query) >= $packetSize) {
$aExecQueries[] = $query;
$query = '';
}
if (count($aExecQueries)) {
foreach ($aExecQueries as $execQuery) {
$result = $oMainDbh->exec($execQuery);
if (PEAR::isError($result)) {
MAX::raiseError($result, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
}
$aExecQueries = array();
}
}
}
}
示例8: getLogoutUrl
/**
* If the agency has set the logout URL in a database, returns this URL
* (trimmed).
* Otherwise, returns 'index.php'.
*
* @param string $agencyId
* @return string Url for redirection after logout.
*/
function getLogoutUrl($agencyId)
{
$doAgency = null;
if ($agencyId) {
$doAgency = OA_Dal::staticGetDO('agency', $agencyId);
}
if ($doAgency && !empty($doAgency->logout_url)) {
return trim($doAgency->logout_url);
}
return MAX::constructURL(MAX_URL_ADMIN, 'index.php');
}
示例9: getFieldType
/**
* This method returns class field type.
*
* @param string $fieldName
* @return string field type
*/
function getFieldType($fieldName)
{
$aFieldsTypes = $this->getFieldsTypes();
if (!isset($aFieldsTypes) || !is_array($aFieldsTypes)) {
MAX::raiseError('Please provide field types array for Info object creation');
}
if (!array_key_exists($fieldName, $aFieldsTypes)) {
MAX::raiseError('Unknown type for field \'' . $fieldName . '\'');
}
return $aFieldsTypes[$fieldName];
}
示例10: redirectIfNecessary
function redirectIfNecessary($adminPage)
{
$oDesiredUrl = new MAX_Url();
$oCurrentUrl = new MAX_Url();
$full_desired_url_string = MAX::constructURL(MAX_URL_ADMIN, $adminPage);
$oDesiredUrl->useValuesFromString($full_desired_url_string);
$oCurrentUrl->useValuesFromServerVariableArray($_SERVER);
if ($oDesiredUrl->equals($oCurrentUrl)) {
return;
}
$this->redirect($adminPage);
}
示例11: OX_Maintenance
function OX_Maintenance()
{
$this->aConf = $GLOBALS['_MAX']['CONF'];
OA_Preferences::loadAdminAccountPreferences();
$this->aPref = $GLOBALS['_MAX']['PREF'];
// Get a connection to the datbase
$this->oDbh =& OA_DB::singleton();
if (PEAR::isError($this->oDbh)) {
// Unable to continue!
MAX::raiseError($this->oDbh, null, PEAR_ERROR_DIE);
}
}
示例12: registerDecorator
/**
* Registers OA_Admin_UI_Decorator for a decorator
*
* @return true if successfully registered, false if there is already decorator
* registered for this name.
*/
function registerDecorator($decoratorName, $path, $className)
{
$decoratorName = strtolower($decoratorName);
if (empty($decoratorName) || empty($path) || empty($className)) {
$errMsg = "DecoratorRegistry::add() Cannot register decorator {$decoratorName} from class {$className} included from {$path}";
return MAX::raiseError($errMsg);
}
if (isset($GLOBALS['_OA_Admin_UI_Decorator_Factory_registered_decorators'][$decoratorName])) {
return false;
}
$GLOBALS['_OA_Admin_UI_Decorator_Factory_registered_decorators'][$decoratorName] = array($path, $className);
return true;
}
示例13: registerJQueryRuleAdaptor
/**
* Registers OA_Admin_UI_Rule_QuickFormToJQueryRuleAdaptor for a given quickform rule
*
* @return true if successfully registered, false if there is already adaptor
* registered for this quickform rule.
*/
function registerJQueryRuleAdaptor($quickFormRuleName, $path, $className)
{
$quickFormRuleName = strtolower($quickFormRuleName);
if (empty($quickFormRuleName) || empty($path) || empty($className)) {
$errMsg = "JQueryRuleAdaptorRegistry::add() Cannot register adaptor for class {$className} for rule {$quickFormRuleName} included from {$path}";
return MAX::raiseError($errMsg);
}
if (isset($GLOBALS['_OA_Admin_UI_Rule_JQueryRuleAdaptorRegistry_registered_adaptors'][$quickFormRuleName])) {
return false;
}
$GLOBALS['_OA_Admin_UI_Rule_JQueryRuleAdaptorRegistry_registered_adaptors'][$quickFormRuleName] = array($path, $className);
return true;
}
示例14: processBucket
/**
* Process an aggregate-type bucket. This is MySQL specific.
*
* @param Plugins_DeliveryLog $oBucket a reference to the using (context) object.
* @param Date $oEnd A PEAR_Date instance, interval_start to process up to (inclusive).
*/
public function processBucket($oBucket, $oEnd)
{
$sTableName = $oBucket->getBucketTableName();
$oMainDbh =& OA_DB_Distributed::singleton();
if (PEAR::isError($oMainDbh)) {
MAX::raiseError($oMainDbh, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
OA::debug(' - Processing the ' . $sTableName . ' table for data with operation interval start equal to or before ' . $oEnd->format('%Y-%m-%d %H:%M:%S') . ' ' . $oEnd->tz->getShortName(), PEAR_LOG_INFO);
// Select all rows with interval_start <= previous OI start.
$rsData =& $this->getBucketTableContent($sTableName, $oEnd);
$rowCount = $rsData->getRowCount();
OA::debug(' - ' . $rsData->getRowCount() . ' records found', PEAR_LOG_DEBUG);
if ($rowCount) {
// We can't do bulk inserts with ON DUPLICATE.
$aExecQueries = array();
if ($rsData->fetch()) {
// Get first row
$aRow = $rsData->toArray();
// Prepare INSERT
$sInsert = "INSERT INTO {$sTableName} (" . join(',', array_keys($aRow)) . ") VALUES ";
// Add first row data
$sRow = '(' . join(',', array_map(array(&$oMainDbh, 'quote'), $aRow)) . ')';
$sOnDuplicate = ' ON DUPLICATE KEY UPDATE count = count + ' . $aRow['count'];
// Add first insert
$aExecQueries[] = $sInsert . $sRow . $sOnDuplicate;
// Deal with the other rows
while ($rsData->fetch()) {
$aRow = $rsData->toArray();
$sRow = '(' . join(',', array_map(array(&$oMainDbh, 'quote'), $aRow)) . ')';
$sOnDuplicate = ' ON DUPLICATE KEY UPDATE count = count + ' . $aRow['count'];
$aExecQueries[] = $sInsert . $sRow . $sOnDuplicate;
}
}
if (count($aExecQueries)) {
// Try to disable the binlog for the inserts so we don't
// replicate back out over our logged data.
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$result = $oMainDbh->exec('SET SQL_LOG_BIN = 0');
if (PEAR::isError($result)) {
OA::debug('Unable to disable the bin log, proceeding anyway.', PEAR_LOG_WARNING);
}
PEAR::staticPopErrorHandling();
foreach ($aExecQueries as $execQuery) {
$result = $oMainDbh->exec($execQuery);
if (PEAR::isError($result)) {
MAX::raiseError($result, MAX_ERROR_DBFAILURE, PEAR_ERROR_DIE);
}
}
}
}
}
示例15: switch
/**
* Creates a new Field object of the appropriate subclass.
*
* @param string $fieldType The type of field to create.
* @return Admin_UI_Field An instance of the correct {@link Admin_UI_Field} subclass.
*/
function &newField($fieldType)
{
switch ($fieldType) {
case 'advertiser':
$oField = new Admin_UI_AdvertiserIdField();
break;
case 'affiliateid-dropdown':
case 'publisherid-dropdown':
$oField = new Admin_UI_PublisherIdField();
break;
case 'campaignid-dropdown':
$oField = new Admin_UI_CampaignSelectionField();
break;
case 'clientid-dropdown':
$oField = new Admin_UI_AdvertiserIdField();
break;
case 'channelid-dropdown':
$oField = new Admin_UI_ChannelIdField();
break;
case 'date-month':
case 'day-span':
case 'day-span-selector':
$oField = new Admin_UI_DaySpanField();
break;
case 'dropdown':
$oField = new Admin_UI_DropdownField();
break;
case 'edit':
$oField = new Admin_UI_TextField();
break;
case 'scope':
$oField = new Admin_UI_OrganisationSelectionField();
break;
case 'sheet':
$oField = new Admin_UI_SheetSelectionField();
break;
case 'trackerid-dropdown':
$oField = new Admin_UI_TrackerField();
break;
case 'zone-scope':
$oField = new Admin_UI_ZoneScopeField();
break;
case 'zoneid-dropdown':
$oField = new Admin_UI_ZoneIdField();
break;
default:
MAX::raiseError("The report module discovered a field type that it didn't know how to handle.", MAX_ERROR_INVALIDARGS);
}
return $oField;
}