本文整理汇总了PHP中OX_Component::getComponents方法的典型用法代码示例。如果您正苦于以下问题:PHP OX_Component::getComponents方法的具体用法?PHP OX_Component::getComponents怎么用?PHP OX_Component::getComponents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OX_Component
的用法示例。
在下文中一共展示了OX_Component::getComponents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* A factory method to return the appropriate
* OA_Maintenance_Priority_DeliveryLimitation_Common
* subclass object (one of OA_Maintenance_Priority_DeliveryLimitation_Date,
* OA_Maintenance_Priority_DeliveryLimitation_Day,
* OA_Maintenance_Priority_DeliveryLimitation_Empty or
* OA_Maintenance_Priority_DeliveryLimitation_Hour), depending on the data
* provided.
*
* @static
* @param array $aDeliveryLimitation An array containing the details of a delivery limitation
* associated with an ad. For example:
* array(
* [ad_id] => 1
* [logical] => and
* [type] => Time:Hour
* [comparison] => ==
* [data] => 1,7,18,23
* [executionorder] => 1
* )
* @return object OA_Maintenance_Priority_DeliveryLimitation_Common
*/
function &factory($aDeliveryLimitation)
{
// Load plugins if not already in cache
if (!isset(self::$aPlugins)) {
self::$aPlugins = OX_Component::getComponents('deliveryLimitations', null, false);
}
// Return instance of the MPE DL class
if (isset(self::$aPlugins[$aDeliveryLimitation['type']])) {
return self::$aPlugins[$aDeliveryLimitation['type']]->getMpeClassInstance($aDeliveryLimitation);
}
// Unknown plugin? Return the empty MPE DL class
return new OA_Maintenance_Priority_DeliveryLimitation_Empty($aDeliveryLimitation);
}
示例2: _findDisplayableReports
/**
* A private method to find all report plugins with can be executed
* by the current user.
*
* @access private
* @return array An array of all the plugins that the user has
* access to excute, indexed by the plugin type.
*/
function _findDisplayableReports()
{
$aDisplayablePlugins = array();
// Get all the report plugins.
$aPlugins = OX_Component::getComponents('reports');
// Check the user's authorization level
foreach ($aPlugins as $pluginType => $oPlugin) {
if (!$oPlugin->isAllowedToExecute()) {
continue;
}
$aDisplayablePlugins[$pluginType] = $oPlugin;
}
return $aDisplayablePlugins;
}
示例3: run
/**
* A method to run distributed maintenance.
*/
function run()
{
if (empty($GLOBALS['_MAX']['CONF']['lb']['enabled'])) {
OA::debug('Distributed stats disabled, not running Maintenance Distributed Engine', PEAR_LOG_INFO);
return;
}
if (!empty($GLOBALS['_MAX']['CONF']['rawDatabase'])) {
$GLOBALS['_MAX']['CONF']['database'] = $GLOBALS['_MAX']['CONF']['rawDatabase'] + $GLOBALS['_MAX']['CONF']['database'];
OA::debug('rawDatabase functionality is being used, switching settings', PEAR_LOG_INFO);
}
$oLock =& OA_DB_AdvisoryLock::factory();
if (!$oLock->get(OA_DB_ADVISORYLOCK_DISTRIBUTED)) {
OA::debug('Maintenance Distributed Engine Already Running', PEAR_LOG_INFO);
return;
}
OA::debug('Running Maintenance Distributed Engine', PEAR_LOG_INFO);
// Attempt to increase PHP memory
OX_increaseMemoryLimit(OX_getMinimumRequiredMemory('maintenance'));
// Ensure the current time is registered with the OA_ServiceLocator
$oServiceLocator =& OA_ServiceLocator::instance();
$oNow =& $oServiceLocator->get('now');
if (!$oNow) {
// Record the current time, and register with the OA_ServiceLocator
$oNow = new Date();
$oServiceLocator->register('now', $oNow);
}
OA::debug(' - Current time is ' . $oNow->format('%Y-%m-%d %H:%M:%S') . ' ' . $oNow->tz->getShortName(), PEAR_LOG_DEBUG);
// Get the components of the deliveryLog extension
$aBuckets = OX_Component::getComponents('deliveryLog');
// Copy buckets' records with "interval_start" up to and including previous OI start,
// and then prune the data processed
$aPreviousOperationIntervalDates = OX_OperationInterval::convertDateToPreviousOperationIntervalStartAndEndDates($oNow);
OA::debug(' - Will process data for all operation intervals before and up to start', PEAR_LOG_DEBUG);
OA::debug(' time of ' . $aPreviousOperationIntervalDates['start']->format('%Y-%m-%d %H:%M:%S') . ' ' . $aPreviousOperationIntervalDates['start']->tz->getShortName(), PEAR_LOG_DEBUG);
foreach ($aBuckets as $sBucketName => $oBucketClass) {
if ($oBucketClass->testStatisticsMigration($oBucketClass->getStatisticsMigration())) {
$oBucketClass->processBucket($aPreviousOperationIntervalDates['start']);
$oBucketClass->pruneBucket($aPreviousOperationIntervalDates['start']);
} else {
OA::debug(' - Skipping ' . $sBucketName, PEAR_LOG_DEBUG);
}
}
$oLock->release();
OA::debug('Maintenance Distributed Engine Completed', PEAR_LOG_INFO);
}
示例4: buildForm
/**
* Append type-specific form elements to the base form
*
* @param object &$form
* @param array &$row
*/
function buildForm(&$form, &$row)
{
$form->setAttribute("onSubmit", "return max_formValidateHtml(this.banner)");
$header = $form->createElement('header', 'header_html', $GLOBALS['strHTMLBanner'] . " - banner code");
$header->setAttribute('icon', 'icon-banner-html.gif');
$form->addElement($header);
$adPlugins = OX_Component::getComponents('3rdPartyServers');
$adPluginsNames = OX_Component::callOnComponents($adPlugins, 'getName');
$adPluginsList = array();
$adPluginsList[''] = $GLOBALS['strAdserverTypeGeneric'];
$adPluginsList['none'] = $GLOBALS['strDoNotAlterHtml'];
foreach ($adPluginsNames as $adPluginKey => $adPluginName) {
$adPluginsList[$adPluginKey] = $adPluginName;
}
$htmlG['textarea'] = $form->createElement('textarea', 'htmltemplate', null, array('class' => 'code', 'cols' => '45', 'rows' => '10', 'wrap' => 'off', 'dir' => 'ltr', 'style' => 'width:550px;'));
$aSelectAttributes = array('id' => 'adserver', 'style' => 'margin-left: 15px;width:230px');
$htmlG['select'] = HTML_QuickForm::createElement('select', 'adserver', $GLOBALS['strAlterHTML'], $adPluginsList, $aSelectAttributes);
$form->addGroup($htmlG, 'html_banner_g', null, array("<br>", ""), false);
$form->addElement('advcheckbox', 'iframe_friendly', $GLOBALS['strIframeFriendly']);
if ($row['bannerid'] && ($row['url'] || $row['target'])) {
// The "url" and "target" elements remain as part of the form definition
// for HTML banners only for existing banners that have either
// url or target already set.
$form->addElement('header', 'header_b_links', "Banner link");
$form->addElement('text', 'url', $GLOBALS['strURL']);
$form->addElement('text', 'target', $GLOBALS['strTarget']);
}
$form->addElement('header', 'header_b_display', 'Banner display');
$sizeG['width'] = $form->createElement('text', 'width', $GLOBALS['strWidth'] . ":");
$sizeG['width']->setSize(5);
$sizeG['height'] = $form->createElement('text', 'height', $GLOBALS['strHeight'] . ":");
$sizeG['height']->setSize(5);
if (!empty($row['bannerid'])) {
$sizeG['height']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");');
$sizeG['width']->setAttribute('onChange', 'oa_sizeChangeUpdateMessage("warning_change_banner_size");');
}
$form->addGroup($sizeG, 'size', $GLOBALS['strSize'], " ", false);
$form->addElement('hidden', 'ext_bannertype', $this->getComponentIdentifier());
//validation rules
$translation = new OX_Translation();
$widthRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strWidth'])), 'required');
$heightRequiredRule = array($translation->translate($GLOBALS['strXRequiredField'], array($GLOBALS['strHeight'])), 'required');
$numericRule = array($GLOBALS['strNumericField'], 'numeric');
$form->addGroupRule('size', array('width' => array($widthRequiredRule, $numericRule), 'height' => array($heightRequiredRule, $numericRule)));
}
示例5: buildForm
function buildForm(&$form, &$row)
{
$form->setAttribute("onSubmit", "return max_formValidateHtml(this.banner)");
$header = $form->createElement('header', 'header_html', $GLOBALS['strHTMLBanner']);
$header->setAttribute('icon', 'icon-banner-html.gif');
$form->addElement($header);
$adPlugins = OX_Component::getComponents('3rdPartyServers');
$adPluginsNames = OX_Component::callOnComponents($adPlugins, 'getName');
$adPluginsList = array();
$adPluginsList[''] = $GLOBALS['strAdserverTypeGeneric'];
$adPluginsList['none'] = $GLOBALS['strDoNotAlterHtml'];
foreach ($adPluginsNames as $adPluginKey => $adPluginName) {
$adPluginsList[$adPluginKey] = $adPluginName;
}
$form->addElement('select', 'adserver', $this->translate($GLOBALS['strAlterHTML']), $adPluginsList, $aSelectAttributes);
$form->addElement('header', 'header_b_parameters', $this->translate("Banner display"));
$form->addElement('text', 'p_link_url', $this->translate($GLOBALS['strURL']));
$form->addElement('text', 'p_link_text', $this->translate("Link text"));
$form->addElement('text', 'p_title', $this->translate("Title"));
$form->addElement('text', 'p_description', $this->translate("Description"));
$form->addElement('text', 'p_image_url', $this->translate("Url Image"));
$form->addElement('text', 'p_click_url_unesc', $this->translate("Click url Unesc"));
$form->addElement('hidden', 'ext_bannertype', $this->getComponentIdentifier());
$bannerId = $row['bannerid'];
if ($bannerId) {
$doBanners = OA_Dal::factoryDO('my_banners');
$doBanners->bannerid = $bannerId;
$doBanners->find(true);
$row['terra_link_url'] = $doBanners->terra_link_url;
$row['terra_link_text'] = $doBanners->terra_link_text;
$row['terra_title'] = $doBanners->terra_title;
$row['terra_description'] = $doBanners->terra_description;
$row['terra_image_url'] = $doBanners->terra_image_url;
$row['terra_click_url_unesc'] = $doBanners->terra_click_url_unesc;
$form->setDefaults(array('p_link_url' => $doBanners->terra_link_url, 'p_link_text' => $doBanners->terra_link_text, 'p_title' => $doBanners->terra_title, 'p_description' => $doBanners->terra_description, 'p_image_url' => $doBanners->terra_image_url, 'p_click_url_unesc' => $doBanners->terra_click_url_unesc));
}
}
示例6: insert
function insert()
{
// $this->setEcpmEnabled();
if ($this->priority == self::PRIORITY_ECPM || $this->ecpm_enabled) {
$this->ecpm = $this->calculateEcpm();
}
// Set the correct campaign status
$this->setStatus();
$id = parent::insert();
if (!$id) {
return $id;
}
// Initalise any tracker based plugins
$plugins = array();
require_once LIB_PATH . '/Plugin/Component.php';
$invocationPlugins =& OX_Component::getComponents('invocationTags');
foreach ($invocationPlugins as $pluginKey => $plugin) {
if (!empty($plugin->trackerEvent)) {
$plugins[] = $plugin;
}
}
// Link automatically any trackers which are marked as "link with any new campaigns"
$doTrackers = $this->factory('trackers');
$doTrackers->clientid = $this->clientid;
$doTrackers->linkcampaigns = 't';
$doTrackers->find();
while ($doTrackers->fetch()) {
$doCampaigns_trackers = $this->factory('campaigns_trackers');
$doCampaigns_trackers->init();
$doCampaigns_trackers->trackerid = $doTrackers->trackerid;
$doCampaigns_trackers->campaignid = $this->campaignid;
$doCampaigns_trackers->clickwindow = $doTrackers->clickwindow;
$doCampaigns_trackers->viewwindow = $doTrackers->viewwindow;
$doCampaigns_trackers->status = $doTrackers->status;
foreach ($plugins as $oPlugin) {
$fieldName = strtolower($oPlugin->trackerEvent);
$doCampaigns_trackers->{$fieldName} = $doTrackers->{$fieldName};
}
$doCampaigns_trackers->insert();
}
return $id;
}
示例7: placeInvocationForm
/**
* Place invocation form - generate form with group of options for every plugin,
* look into max/docs/developer/plugins.zuml for more details
*
* @param array $extra
* @param boolean $zone_invocation
*
* @return string Generated invocation form
*/
function placeInvocationForm($extra = '', $zone_invocation = false)
{
$conf = $GLOBALS['_MAX']['CONF'];
$pref = $GLOBALS['_MAX']['PREF'];
$globalVariables = array('affiliateid', 'codetype', 'size', 'text', 'dest');
$buffer = '';
$this->zone_invocation = $zone_invocation;
foreach ($globalVariables as $makeMeGlobal) {
global ${$makeMeGlobal};
// also make this variable a class attribute
// so plugins could have an access to these values and modify them
$this->{$makeMeGlobal} =& ${$makeMeGlobal};
}
$invocationTypes =& OX_Component::getComponents('invocationTags');
foreach ($invocationTypes as $pluginKey => $invocationType) {
if (!empty($invocationType->publisherPlugin)) {
$available[$pluginKey] = $invocationType->publisherPlugin;
$names[$pluginKey] = $invocationType->getName();
if (!empty($invocationType->default)) {
$defaultPublisherPlugin = $pluginKey;
}
}
}
$affiliateid = $this->affiliateid;
if (count($available) == 1) {
// Only one publisher invocation plugin available
$codetype = $defaultPublisherPlugin;
} elseif (count($available) > 1) {
// Multiple publisher invocation plugins available
if (is_null($codetype)) {
$codetype = $defaultPublisherPlugin;
}
echo "<form name='generate' action='" . $_SERVER['PHP_SELF'] . "' method='POST' onSubmit='return max_formValidate(this);'>\n";
// Show the publisher invocation selection drop down
echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
echo "<input type='hidden' name='affiliateid' value='{$affiliateid}'>";
echo "<tr><td height='25' colspan='3'><b>" . $GLOBALS['strChooseTypeOfInvocation'] . "</b></td></tr>";
echo "<tr><td height='35'>";
echo "<select name='codetype' onChange=\"this.form.submit()\" accesskey=" . $GLOBALS['keyList'] . " tabindex='" . $tabindex++ . "'>";
foreach ($names as $pluginKey => $invocationTypeName) {
echo "<option value='" . $pluginKey . "'" . ($codetype == $pluginKey ? ' selected' : '') . ">" . $invocationTypeName . "</option>";
}
echo "</select>";
echo " <input type='image' src='" . OX::assetPath() . "/images/" . $GLOBALS['phpAds_TextDirection'] . "/go_blue.gif' border='0'>";
echo "</td></tr></table>";
echo "</form>";
echo phpAds_ShowBreak($print = false);
echo "<br />";
} else {
// No publisher invocation plugins available
$code = 'Error: No publisher invocation plugins available';
return;
}
if (!empty($codetype)) {
$invocationTag = OX_Component::factoryByComponentIdentifier($codetype);
if ($invocationTag === false) {
OA::debug('Error while factory invocationTag plugin');
exit;
}
$code = $this->generateInvocationCode($invocationTag);
}
$previewURL = MAX::constructURL(MAX_URL_ADMIN, "affiliate-preview.php?affiliateid={$affiliateid}&codetype={$codetype}");
foreach ($invocationTag->defaultOptionValues as $feature => $value) {
if ($invocationTag->maxInvocation->{$feature} != $value) {
$previewURL .= "&{$feature}=" . rawurlencode($invocationTag->maxInvocation->{$feature});
}
}
foreach ($this->defaultOptionValues as $feature => $value) {
if ($this->{$feature} != $value) {
$previewURL .= "&{$feature}=" . rawurlencode($this->{$feature});
}
}
echo "<form name='generate' action='" . $previewURL . "' method='get' target='_blank'>\n";
echo "<input type='hidden' name='codetype' value='" . $codetype . "' />";
// Show parameters for the publisher invocation list
echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
echo "<tr><td height='25' colspan='3'><img src='" . OX::assetPath() . "/images/icon-overview.gif' align='absmiddle'> <b>" . $GLOBALS['strParameters'] . "</b></td></tr>";
echo "<tr height='1'><td width='30'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='30'></td>";
echo "<td width='200'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='200'></td>";
echo "<td width='100%'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
echo $invocationTag->generateOptions($this);
echo "<tr><td height='10' colspan='3'> </td></tr>";
//echo "<tr height='1'><td colspan='3' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
echo "</table>";
// Pass in current values
echo "<input type='hidden' name='affiliateid' value='{$affiliateid}' />";
echo "<input type='submit' value='" . $GLOBALS['strGenerate'] . "' name='submitbutton' tabindex='" . $tabindex++ . "'>";
echo "</form>";
}
示例8: MAX_displayAcls
function MAX_displayAcls($acls, $aParams)
{
$tabindex =& $GLOBALS['tabindex'];
$page = basename($_SERVER['SCRIPT_NAME']);
$conf = $GLOBALS['_MAX']['CONF'];
echo "<form action='{$page}' method='post'>";
echo "<label><img src='" . OX::assetPath() . "/images/icon-acl-add.gif' align='absmiddle'> " . $GLOBALS['strACLAdd'] . ": ";
echo "<select name='type' accesskey='{$GLOBALS['keyAddNew']}' tabindex='" . $tabindex++ . "'>";
$deliveryLimitations = OX_Component::getComponents('deliveryLimitations', null, false);
foreach ($deliveryLimitations as $pluginName => $plugin) {
if ($plugin->isAllowed($page)) {
echo "<option value='{$pluginName}'>" . $plugin->getName() . "</option>";
}
}
echo "</select></label>";
echo " ";
echo "<input type='submit' class='flat' name='action[new]' value='" . $GLOBALS['strAdd'] . "'";
phpAds_ShowBreak();
echo "<br />";
$aErrors = OX_AclCheckInputsFields($acls, $page);
if (!empty($GLOBALS['action'])) {
// We are part way through making changes, show a message
//echo "<br>";
echo "<div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/warning.gif' align='absmiddle'>";
echo "<span class='tab-s'>{$GLOBALS['strUnsavedChanges']}</span><br>";
echo "</div>";
} elseif (!MAX_AclValidate($page, $aParams)) {
echo "<div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/warning.gif' align='absmiddle'>";
echo "<span class='tab-r'>{$GLOBALS['strDeliveryLimitationsDisagree']}</span><br>";
echo "</div>";
}
if ($aErrors !== true) {
echo "<div class='errormessage'><img class='errormessage' src='" . OX::assetPath() . "/images/warning.gif' align='absmiddle'>";
echo "<span class='tab-s'>{$GLOBALS['strDeliveryLimitationsInputErrors']}</span><br><ul>";
foreach ($aErrors as $error) {
echo "<li><span class='tab-s'>{$error}</span><br></li>";
}
echo "</ul></div>";
}
foreach ($aParams as $name => $value) {
echo "<input type='hidden' name='{$name}' value='{$value}' />";
}
echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
echo "<tr><td height='25' colspan='4' bgcolor='#FFFFFF'><b>{$GLOBALS['strDeliveryLimitations']}</b></td></tr>";
echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
if (empty($acls)) {
echo "<tr><td height='24' colspan='4' bgcolor='#F6F6F6'> {$GLOBALS['strNoLimitations']}</td></tr>";
echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
} else {
echo "<tr><td height='25' colspan='4' bgcolor='#F6F6F6'> {$GLOBALS['strOnlyDisplayWhen']}</td></tr>";
echo "<tr><td colspan='4'><img src='" . OX::assetPath() . "/images/break-el.gif' width='100%' height='1'></td></tr>";
foreach ($acls as $aclId => $acl) {
if ($deliveryLimitationPlugin = OA_aclGetComponentFromRow($acl)) {
$deliveryLimitationPlugin->init($acl);
$deliveryLimitationPlugin->count = count($acls);
if ($deliveryLimitationPlugin->isAllowed($page)) {
$deliveryLimitationPlugin->display();
}
}
}
}
echo "<tr><td height='30' colspan='2'>";
if (!empty($acls)) {
$url = $page . '?';
foreach ($aParams as $name => $value) {
$url .= "{$name}={$value}&";
}
$url .= "action[clear]=true";
echo "<img src='" . OX::assetPath() . "/images/icon-recycle.gif' border='0' align='absmiddle'> \n <a href='{$url}'>{$GLOBALS['strRemoveAllLimitations']}</a> \n ";
}
echo "</td><td height='30' colspan='2' align='{$GLOBALS['phpAds_TextAlignRight']}'>";
echo "</td></tr>";
echo "</table>";
}
示例9: testGetAllowedTags
function testGetAllowedTags()
{
TestEnv::installPluginPackage('openXInvocationTags');
$dllZone = new OA_Dll_Zone();
$aZoneAllowedTags = $dllZone->getAllowedTags();
// Test if only and all allowed tags are returned
$count = 0;
$invocationTags =& OX_Component::getComponents('invocationTags');
foreach ($invocationTags as $pluginKey => $invocationTag) {
if ($invocationTag->isAllowed(null, null)) {
$count++;
$this->assertTrue(in_array($pluginKey, $aZoneAllowedTags));
} else {
$this->assertFalse(in_array($pluginKey, $aZoneAllowedTags));
}
}
$this->assertEqual($count, count($aZoneAllowedTags));
// tests if spc is disallowed anyway
$GLOBALS['_MAX']['CONF']['spc']['allowed'] = true;
$aZoneAllowedTags = $dllZone->getAllowedTags();
$this->assertFalse(in_array('spc', $aZoneAllowedTags));
unset($GLOBALS['_MAX']['CONF']['spc']['allowed']);
TestEnv::uninstallPluginPackage('openXInvocationTags');
}
示例10: buildAlgorithmFormSection
function buildAlgorithmFormSection($form, $aZone)
{
$aAlgorithmPlugins = OX_Component::getComponents('deliveryAdSelect');
if (!empty($aAlgorithmPlugins) && is_array($aAlgorithmPlugins)) {
// Add the 'Default' (internal) algorithm to the list
$aItems = array('none' => 'Default (internal)');
foreach ($aAlgorithmPlugins as $oAlgorithmPlugin) {
// Only include components which implement the onDemand adselect hook function
// This is not the cleanest way to do it :( but it works :)
$aInfo = $oAlgorithmPlugin->parseComponentIdentifier($oAlgorithmPlugin->getComponentIdentifier());
if (function_exists('Plugin_' . implode('_', $aInfo) . '_Delivery' . '_adSelect')) {
$aItems[$oAlgorithmPlugin->getComponentIdentifier()] = $oAlgorithmPlugin->getName();
}
}
// Only display the select box if at least one alternative algorithm is provided
if (count($aItems) === 1) {
$form->addElement('hidden', 'ext_adselection', 'none');
return;
}
$form->addElement('header', 'header_algorithm', 'Ad selection algorithm');
$form->addElement('select', 'ext_adselection', 'Plugin to use for ad selection in this zone', $aItems);
}
}
示例11: test_getComponents
function test_getComponents()
{
$GLOBALS['_MAX']['CONF']['pluginPaths']['plugins'] = '/lib/OX/Plugin/tests/data/testExtensions/';
$GLOBALS['_MAX']['CONF']['pluginPaths']['admin'] = '/lib/OX/Plugin/tests/data/www/admin/plugins/';
$GLOBALS['_MAX']['CONF']['pluginGroupComponents'] = array('testGroup1' => 1, 'testGroup2' => 1, 'testPlugin' => 1);
$aComponents = OX_Component::getComponents('testExtension1', 'testGroup1', true);
$this->assertTrue(isset($aComponents['testExtension1:testGroup1:testComponent1']));
$this->assertEqual($aComponents['testExtension1:testGroup1:testComponent1']->extension, 'testExtension1');
$this->assertEqual($aComponents['testExtension1:testGroup1:testComponent1']->group, 'testGroup1');
$this->assertEqual($aComponents['testExtension1:testGroup1:testComponent1']->component, 'testComponent1');
$this->assertEqual($aComponents['testExtension1:testGroup1:testComponent1']->enabled, true);
$this->assertTrue(isset($aComponents['testExtension1:testGroup1:testComponent2']));
$this->assertEqual($aComponents['testExtension1:testGroup1:testComponent2']->extension, 'testExtension1');
$this->assertEqual($aComponents['testExtension1:testGroup1:testComponent2']->group, 'testGroup1');
$this->assertEqual($aComponents['testExtension1:testGroup1:testComponent2']->component, 'testComponent2');
$this->assertEqual($aComponents['testExtension1:testGroup1:testComponent2']->enabled, true);
$aComponents = OX_Component::getComponents('admin', 'testPlugin', false);
$this->assertTrue(isset($aComponents['admin:testPlugin:testPlugin']));
$this->assertEqual($aComponents['admin:testPlugin:testPlugin']->extension, 'admin');
$this->assertEqual($aComponents['admin:testPlugin:testPlugin']->group, 'testPlugin');
$this->assertEqual($aComponents['admin:testPlugin:testPlugin']->component, 'testPlugin');
$this->assertEqual($aComponents['admin:testPlugin:testPlugin']->enabled, true);
TestEnv::restoreConfig();
}
示例12: _getComponents
/**
* Required for mocking OX_Component::getComponents
*
* @return array Array of components in chosen extension, group
*/
function _getComponents($extension, $group, $recursive = 1, $enabledOnly = false)
{
return OX_Component::getComponents($extension, $group, $recursive, $enabledOnly);
}
示例13: phpAds_registerGlobal
require_once LIB_PATH . '/Plugin/Component.php';
// Register input variables
phpAds_registerGlobal('action', 'trackerids', 'clickwindowday', 'clickwindowhour', 'clickwindowminute', 'clickwindows', 'clickwindowsecond', 'hideinactive', 'statusids', 'submit', 'viewwindowday', 'viewwindowhour', 'viewwindowminute', 'viewwindows', 'viewwindowsecond');
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
OA_Permission::enforceAccessToObject('clients', $clientid);
OA_Permission::enforceAccessToObject('campaigns', $campaignid);
/*-------------------------------------------------------*/
/* Store preferences */
/*-------------------------------------------------------*/
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid] = $campaignid;
phpAds_SessionDataStore();
// Initalise any tracker based plugins
$plugins = array();
$invocationPlugins =& OX_Component::getComponents('invocationTags');
foreach ($invocationPlugins as $pluginKey => $plugin) {
if (!empty($plugin->trackerEvent)) {
$plugins[] = $plugin;
$fieldName = strtolower($plugin->trackerEvent);
phpAds_registerGlobal("{$fieldName}windowday", "{$fieldName}windowhour", "{$fieldName}windowminute", "{$fieldName}windowsecond", "{$fieldName}windows");
}
}
/*-------------------------------------------------------*/
/* Process submitted form */
/*-------------------------------------------------------*/
if (!empty($campaignid)) {
if (isset($action) && $action == 'set') {
$clickWindow = _windowValuesToseconds($clickwindowday, $clickwindowhour, $clickwindowminute, $clickwindowsecond);
$viewWindow = _windowValuesToseconds($viewwindowday, $viewwindowhour, $viewwindowminute, $viewwindowsecond);
$doCampaigns = OA_Dal::staticGetDO('campaigns', $campaignid);
示例14: thirdPartyServer
/**
* Generate the HTML option for output adserver selection
*
* @return string A string containing html for option
*/
function thirdPartyServer()
{
$conf = $GLOBALS['_MAX']['CONF'];
$pref = $GLOBALS['_MAX']['PREF'];
$selectedOutputAdServer = is_null($this->maxInvocation->thirdpartytrack) ? $conf['delivery']['clicktracking'] : $this->maxInvocation->thirdpartytrack;
$maxInvocation =& $this->maxInvocation;
$option = '';
$option .= "\n <tr>\n <td width='30'> </td>\n <td width='200'>{$GLOBALS['str3rdPartyTrack']}</td>\n <td width='370'>\n ";
// Add selection box for output adservers
$option .= "<select name='thirdpartytrack' tabindex='" . $maxInvocation->tabindex++ . "'>";
$option .= "<option value='0'>{$GLOBALS['strNo']}</option>";
$option .= "<option value='generic' " . ($maxInvocation->thirdpartytrack == 'generic' ? " selected='selected'" : '') . ">{$GLOBALS['strGenericOutputAdServer']}</option>";
$outputAdServers =& OX_Component::getComponents('3rdPartyServers');
$availableOutputAdServerNames = array();
foreach ($outputAdServers as $pluginKey => $outputAdServer) {
if (!empty($outputAdServer->hasOutputMacros)) {
$availableOutputAdServers[$pluginKey] = $outputAdServer;
$availableOutputAdServerNames[$pluginKey] = $outputAdServer->getName();
}
}
asort($availableOutputAdServerNames);
foreach ($availableOutputAdServerNames as $pluginKey => $outputAdServerName) {
$option .= "<option value='{$pluginKey}'" . ($maxInvocation->thirdpartytrack == $pluginKey ? ' selected="selected"' : '') . ">" . $outputAdServerName . "</option>";
}
$option .= "</select>";
$option .= "</tr>";
$option .= "<tr><td width='30'><img src='" . OX::assetPath() . "/images/spacer.gif' height='5' width='100%'></td></tr>";
return $option;
}
示例15: array
$formDisabled = !$oComponent || !$oComponent->enabled;
if ($oComponent) {
$ext_bannertype = $type;
$type = $oComponent->getStorageType();
} else {
$ext_bannertype = '';
$type = '';
}
}
$show_txt = $conf['allowedBanners']['text'];
if (isset($type) && $type == "txt") {
$show_txt = true;
}
$bannerTypes = array();
if ($show_txt) {
$aBannerTypeText = OX_Component::getComponents('bannerTypeText');
foreach ($aBannerTypeText as $tmpComponent) {
$componentIdentifier = $tmpComponent->getComponentIdentifier();
$bannerTypes['text'][$componentIdentifier] = $tmpComponent->getOptionDescription();
}
}
if (!$type) {
if ($show_txt) {
$type = "txt";
}
}
$form = buildBannerForm($type, $aBanner, $oComponent, $formDisabled);
$valid = $form->validate();
if ($valid && $oComponent && $oComponent->enabled) {
$valid = $oComponent->validateForm($form);
}