当前位置: 首页>>代码示例>>PHP>>正文


PHP MapUtils类代码示例

本文整理汇总了PHP中MapUtils的典型用法代码示例。如果您正苦于以下问题:PHP MapUtils类的具体用法?PHP MapUtils怎么用?PHP MapUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MapUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetAllImagesAndVideosExample

/**
 * Runs the example.
 * @param AdWordsUser $user the user to run the example with
 */
function GetAllImagesAndVideosExample(AdWordsUser $user)
{
    // Get the service, which loads the required classes.
    $mediaService = $user->GetService('MediaService', ADWORDS_VERSION);
    // Create selector.
    $selector = new Selector();
    $selector->fields = array('MediaId', 'Width', 'Height', 'MimeType', 'Name');
    $selector->ordering = array(new OrderBy('MediaId', 'ASCENDING'));
    // Create predicates.
    $selector->predicates[] = new Predicate('Type', 'IN', array('IMAGE', 'VIDEO'));
    // Create paging controls.
    $selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
    do {
        // Make the get request.
        $page = $mediaService->get($selector);
        // Display images.
        if (isset($page->entries)) {
            foreach ($page->entries as $media) {
                if ($media->MediaType == 'Image') {
                    $dimensions = MapUtils::GetMap($media->dimensions);
                    printf("Image with dimensions '%dx%d', MIME type '%s', and id '%s' " . "was found.\n", $dimensions['FULL']->width, $dimensions['FULL']->height, $media->mimeType, $media->mediaId);
                } else {
                    if ($media->MediaType == 'Video') {
                        printf("Video with name '%s' and id '%s' was found.\n", $media->name, $media->mediaId);
                    }
                }
            }
        } else {
            print "No images or videos were found.\n";
        }
        // Advance the paging index.
        $selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE;
    } while ($page->totalNumEntries > $selector->paging->startIndex);
}
开发者ID:googleads,项目名称:googleads-php-lib,代码行数:38,代码来源:GetAllImagesAndVideos.php

示例2: GetKeywordIdeasExample

/**
 * Runs the example.
 * @param AdWordsUser $user the user to run the example with
 */
function GetKeywordIdeasExample(AdWordsUser $user)
{
    // Get the service, which loads the required classes.
    $targetingIdeaService = $user->GetService('TargetingIdeaService', ADWORDS_VERSION);
    // Create selector.
    $selector = new TargetingIdeaSelector();
    $selector->requestType = 'IDEAS';
    $selector->ideaType = 'KEYWORD';
    $selector->requestedAttributeTypes = array('KEYWORD_TEXT', 'SEARCH_VOLUME', 'CATEGORY_PRODUCTS_AND_SERVICES');
    // Create seed keyword.
    $keyword = 'mars cruise';
    // Create related to query search parameter.
    $relatedToQuerySearchParameter = new RelatedToQuerySearchParameter();
    $relatedToQuerySearchParameter->queries = array($keyword);
    $selector->searchParameters[] = $relatedToQuerySearchParameter;
    // Create language search parameter (optional).
    // The ID can be found in the documentation:
    //   https://developers.google.com/adwords/api/docs/appendix/languagecodes
    // Note: As of v201302, only a single language parameter is allowed.
    $languageParameter = new LanguageSearchParameter();
    $english = new Language();
    $english->id = 1000;
    $languageParameter->languages = array($english);
    $selector->searchParameters[] = $languageParameter;
    // Create network search parameter (optional).
    $networkSetting = new NetworkSetting();
    $networkSetting->targetGoogleSearch = true;
    $networkSetting->targetSearchNetwork = false;
    $networkSetting->targetContentNetwork = false;
    $networkSetting->targetPartnerSearchNetwork = false;
    $networkSearchParameter = new NetworkSearchParameter();
    $networkSearchParameter->networkSetting = $networkSetting;
    $selector->searchParameters[] = $networkSearchParameter;
    // Set selector paging (required by this service).
    $selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
    do {
        // Make the get request.
        $page = $targetingIdeaService->get($selector);
        // Display results.
        if (isset($page->entries)) {
            foreach ($page->entries as $targetingIdea) {
                $data = MapUtils::GetMap($targetingIdea->data);
                $keyword = $data['KEYWORD_TEXT']->value;
                $search_volume = isset($data['SEARCH_VOLUME']->value) ? $data['SEARCH_VOLUME']->value : 0;
                if ($data['CATEGORY_PRODUCTS_AND_SERVICES']->value === null) {
                    $categoryIds = '';
                } else {
                    $categoryIds = implode(', ', $data['CATEGORY_PRODUCTS_AND_SERVICES']->value);
                }
                printf("Keyword idea with text '%s', category IDs (%s) and average " . "monthly search volume '%s' was found.\n", $keyword, $categoryIds, $search_volume);
            }
        } else {
            print "No keywords ideas were found.\n";
        }
        // Advance the paging index.
        $selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE;
    } while ($page->totalNumEntries > $selector->paging->startIndex);
}
开发者ID:googleads,项目名称:googleads-php-lib,代码行数:62,代码来源:GetKeywordIdeas.php

示例3: UploadImageExample

/**
 * Runs the example.
 * @param AdWordsUser $user the user to run the example with
 */
function UploadImageExample(AdWordsUser $user)
{
    // Get the service, which loads the required classes.
    $mediaService = $user->GetService('MediaService', ADWORDS_VERSION);
    // Create image.
    $image = new Image();
    $image->data = MediaUtils::GetBase64Data('http://goo.gl/HJM3L');
    $image->type = 'IMAGE';
    // Make the upload request.
    $result = $mediaService->upload(array($image));
    // Display result.
    $image = $result[0];
    $dimensions = MapUtils::GetMap($image->dimensions);
    printf("Image with dimensions '%dx%d', MIME type '%s', and id '%s' was " . "uploaded.\n", $dimensions['FULL']->width, $dimensions['FULL']->height, $image->mimeType, $image->mediaId);
}
开发者ID:googleads,项目名称:googleads-php-lib,代码行数:19,代码来源:UploadImage.php

示例4: UploadMediaBundleExample

/**
 * Runs the example.
 * @param AdWordsUser $user the user to run the example with
 */
function UploadMediaBundleExample(AdWordsUser $user)
{
    // Get the service, which loads the required classes.
    $mediaService = $user->GetService('MediaService', ADWORDS_VERSION);
    // Create HTML5 media.
    $html5Zip = new MediaBundle();
    $html5Zip->data = MediaUtils::GetBase64Data('https://goo.gl/9Y7qI2');
    $html5Zip->type = 'MEDIA_BUNDLE';
    // Make the upload request.
    $result = $mediaService->upload(array($html5Zip));
    // Display result.
    $mediaBundle = $result[0];
    $dimensions = MapUtils::GetMap($mediaBundle->dimensions);
    printf("HTML5 media with ID %d, dimensions '%dx%d', MIME type '%s' was " . "uploaded.\n", $mediaBundle->mediaId, $dimensions['FULL']->width, $dimensions['FULL']->height, $mediaBundle->mimeType);
}
开发者ID:AndrewGMH,项目名称:googleads-php-lib,代码行数:19,代码来源:UploadMediaBundle.php

示例5: GetKeywordIdeas

 function GetKeywordIdeas($adVersion, \AdWordsUser $user, $keywords)
 {
     $result = [];
     // Get the service, which loads the required classes.
     $targetingIdeaService = $user->GetService('TargetingIdeaService', $adVersion);
     // Create selector.
     $selector = new \TargetingIdeaSelector();
     $selector->requestType = 'STATS';
     $selector->ideaType = 'KEYWORD';
     $selector->requestedAttributeTypes = array('KEYWORD_TEXT', 'SEARCH_VOLUME', 'CATEGORY_PRODUCTS_AND_SERVICES');
     $locationParameter = new \LocationSearchParameter();
     $unitedStates = new \Location();
     $unitedStates->id = 2840;
     $locationParameter->locations = [$unitedStates];
     $networkParameter = new \NetworkSearchParameter();
     $networdSettings = new \NetworkSetting();
     $networdSettings->targetGoogleSearch = true;
     $networdSettings->targetSearchNetwork = false;
     $networdSettings->targetContentNetwork = false;
     $networdSettings->targetPartnerSearchNetwork = false;
     $networkParameter->networkSetting = $networdSettings;
     // Create related to query search parameter.
     $relatedToQuerySearchParameter = new \RelatedToQuerySearchParameter();
     $relatedToQuerySearchParameter->queries = $keywords;
     $selector->searchParameters[] = $relatedToQuerySearchParameter;
     $selector->searchParameters[] = $locationParameter;
     $selector->searchParameters[] = $networkParameter;
     // Set selector paging (required by this service).
     $selector->paging = new \Paging(0, \AdWordsConstants::RECOMMENDED_PAGE_SIZE);
     do {
         // Make the get request.
         $page = $targetingIdeaService->get($selector);
         // Display results.
         if (isset($page->entries)) {
             foreach ($page->entries as $targetingIdea) {
                 $data = \MapUtils::GetMap($targetingIdea->data);
                 $saerchValue = isset($data['SEARCH_VOLUME']->value) ? $data['SEARCH_VOLUME']->value : 0;
                 $result[] = ['keyword' => $data['KEYWORD_TEXT']->value, 'value' => $saerchValue];
             }
         } else {
             print "No keywords ideas were found.\n";
         }
         // Advance the paging index.
         $selector->paging->startIndex += \AdWordsConstants::RECOMMENDED_PAGE_SIZE;
     } while ($page->totalNumEntries > $selector->paging->startIndex);
     return $result;
 }
开发者ID:hxhxd,项目名称:yii2-google-adwords-helpers,代码行数:47,代码来源:Planner.php

示例6: getOrdersByCompanyId

 public function getOrdersByCompanyId($id = false)
 {
     if (!$id) {
         return;
     }
     $path = dirname(__FILE__) . '/dfp/src';
     set_include_path(get_include_path() . PATH_SEPARATOR . $path);
     require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
     require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
     $token = "company_orders_" . $id;
     if (($data = Cache::read($token, "5min")) === false) {
         $data = array();
         try {
             // Get DfpUser from credentials in "../auth.ini"
             // relative to the DfpUser.php file's directory.
             $user = new DfpUser();
             // Log SOAP XML request and response.
             $user->LogDefaults();
             // Get the OrderService.
             $orderService = $user->GetOrderService('v201108');
             // Set the ID of the advertiser (company) to get orders for.
             $advertiserId = (double) $id;
             // Create bind variables.
             $vars = MapUtils::GetMapEntries(array('advertiserId' => new NumberValue($advertiserId)));
             // Create a statement to only select orders for a given advertiser.
             $filterStatement = new Statement("WHERE advertiserId = :advertiserId LIMIT 500", $vars);
             // Get orders by statement.
             $page = $orderService->getOrdersByStatement($filterStatement);
             // Display results.
             if (isset($page->results)) {
                 $i = $page->startIndex;
                 foreach ($page->results as $k => $order) {
                     $data[$k]['id'] = $order->id;
                     $data[$k]['name'] = $order->name;
                     $data[$k]['advertiserId'] = $order->advertiserId;
                 }
             }
             Cache::write($token, $data, "5min");
         } catch (Exception $e) {
             die($e->getMessage());
         }
     }
     return $data;
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:44,代码来源:DfpApi.php

示例7: GetKeywordIdeasExample

/**
 * Runs the example.
 * @param AdWordsUser $user the user to run the example with
 */
function GetKeywordIdeasExample(AdWordsUser $user)
{
    // Get the service, which loads the required classes.
    $targetingIdeaService = $user->GetService('TargetingIdeaService', 'v201109_1');
    // Create seed keyword.
    $keyword = new Keyword();
    $keyword->text = 'mars cruise';
    $keyword->matchType = 'BROAD';
    // Create selector.
    $selector = new TargetingIdeaSelector();
    $selector->requestType = 'IDEAS';
    $selector->ideaType = 'KEYWORD';
    $selector->requestedAttributeTypes = array('CRITERION', 'AVERAGE_TARGETED_MONTHLY_SEARCHES', 'CATEGORY_PRODUCTS_AND_SERVICES');
    // Create related to keyword search parameter.
    $selector->searchParameters[] = new RelatedToKeywordSearchParameter(array($keyword));
    // Create keyword match type search parameter to ensure unique results.
    $selector->searchParameters[] = new KeywordMatchTypeSearchParameter(array('BROAD'));
    // Set selector paging (required by this service).
    $selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
    do {
        // Make the get request.
        $page = $targetingIdeaService->get($selector);
        // Display results.
        if (isset($page->entries)) {
            foreach ($page->entries as $targetingIdea) {
                $data = MapUtils::GetMap($targetingIdea->data);
                $keyword = $data['CRITERION']->value;
                $averageMonthlySearches = isset($data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value) ? $data['AVERAGE_TARGETED_MONTHLY_SEARCHES']->value : 0;
                $categoryIds = implode(', ', $data['CATEGORY_PRODUCTS_AND_SERVICES']->value);
                printf("Keyword idea with text '%s', match type '%s', category IDs " . "(%s) and average monthly search volume '%s' was found.\n", $keyword->text, $keyword->matchType, $categoryIds, $averageMonthlySearches);
            }
        } else {
            print "No keywords ideas were found.\n";
        }
        // Advance the paging index.
        $selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE;
    } while ($page->totalNumEntries > $selector->paging->startIndex);
}
开发者ID:sambavade,项目名称:google-api-adwords-php,代码行数:42,代码来源:GetKeywordIdeas.php

示例8: GetPlacementIdeasExample

/**
 * Runs the example.
 * @param AdWordsUser $user the user to run the example with
 */
function GetPlacementIdeasExample(AdWordsUser $user)
{
    // Get the service, which loads the required classes.
    $targetingIdeaService = $user->GetService('TargetingIdeaService', ADWORDS_VERSION);
    // Create seed url.
    $url = 'mars.google.com';
    // Create selector.
    $selector = new TargetingIdeaSelector();
    $selector->requestType = 'IDEAS';
    $selector->ideaType = 'PLACEMENT';
    $selector->requestedAttributeTypes = array('CRITERION', 'PLACEMENT_TYPE');
    // Create related to url search parameter.
    $relatedToUrlSearchParameter = new RelatedToUrlSearchParameter();
    $relatedToUrlSearchParameter->urls = array($url);
    $relatedToUrlSearchParameter->includeSubUrls = FALSE;
    $selector->searchParameters[] = $relatedToUrlSearchParameter;
    // Set selector paging (required by this service).
    $selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
    do {
        // Make the get request.
        $page = $targetingIdeaService->get($selector);
        // Display related placements.
        if (isset($page->entries)) {
            foreach ($page->entries as $targetingIdea) {
                $data = MapUtils::GetMap($targetingIdea->data);
                $placement = $data['CRITERION']->value;
                $placementType = $data['PLACEMENT_TYPE']->value;
                printf("Placement with url '%s' and type '%s' was found.\n", $placement->url, $placementType);
            }
        } else {
            print "No related placements were found.\n";
        }
        // Advance the paging index.
        $selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE;
    } while ($page->totalNumEntries > $selector->paging->startIndex);
}
开发者ID:sambavade,项目名称:google-api-adwords-php,代码行数:40,代码来源:GetPlacementIdeas.php

示例9: GetKeywordIdeasExample

/**
 * Runs the example.
 * @param AdWordsUser $user the user to run the example with
 */
function GetKeywordIdeasExample(AdWordsUser $user)
{
    // Get the service, which loads the required classes.
    $targetingIdeaService = $user->GetService('TargetingIdeaService', ADWORDS_VERSION);
    // Create seed keyword.
    $keyword = 'mars cruise';
    // Create selector.
    $selector = new TargetingIdeaSelector();
    $selector->requestType = 'IDEAS';
    $selector->ideaType = 'KEYWORD';
    $selector->requestedAttributeTypes = array('KEYWORD_TEXT', 'SEARCH_VOLUME', 'CATEGORY_PRODUCTS_AND_SERVICES');
    // Create related to query search parameter.
    $relatedToQuerySearchParameter = new RelatedToQuerySearchParameter();
    $relatedToQuerySearchParameter->queries = array($keyword);
    $selector->searchParameters[] = $relatedToQuerySearchParameter;
    // Set selector paging (required by this service).
    $selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
    do {
        // Make the get request.
        $page = $targetingIdeaService->get($selector);
        // Display results.
        if (isset($page->entries)) {
            foreach ($page->entries as $targetingIdea) {
                $data = MapUtils::GetMap($targetingIdea->data);
                $keyword = $data['KEYWORD_TEXT']->value;
                $search_volume = isset($data['SEARCH_VOLUME']->value) ? $data['SEARCH_VOLUME']->value : 0;
                $categoryIds = implode(', ', $data['CATEGORY_PRODUCTS_AND_SERVICES']->value);
                printf("Keyword idea with text '%s', category IDs (%s) and average " . "monthly search volume '%s' was found.\n", $keyword, $categoryIds, $search_volume);
            }
        } else {
            print "No keywords ideas were found.\n";
        }
        // Advance the paging index.
        $selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE;
    } while ($page->totalNumEntries > $selector->paging->startIndex);
}
开发者ID:sambavade,项目名称:google-api-adwords-php,代码行数:40,代码来源:GetKeywordIdeas.php

示例10: Create

 /**
  * Creates a new object of the given type, using the optional parameters.
  * When pseudo-namespace support is enabled class names can become very long,
  * and this function provides an alternative way to create objects that is
  * more readable.
  * @param string $type the type of object to create
  * @param array $params parameters to pass into the constructor, as either
  *     flat array in the correct order for the constructor or as an
  *     associative array from parameter name to value
  * @return mixed a new instance of a class that represents that type
  */
 public function Create($type, $params = null)
 {
     if (array_key_exists($type, $this->options['classmap'])) {
         $class = $this->options['classmap'][$type];
         $reflectionClass = new ReflectionClass($class);
         if (isset($params)) {
             if (MapUtils::IsMap($params)) {
                 $params = MapUtils::MapToMethodParameters($params, $reflectionClass->getConstructor());
             }
             return $reflectionClass->newInstanceArgs($params);
         } else {
             return $reflectionClass->newInstance();
         }
     } else {
         trigger_error('Unknown type: ' . $type, E_USER_ERROR);
     }
 }
开发者ID:a1pro,项目名称:adwords_dashboard,代码行数:28,代码来源:AdsSoapClient.php

示例11: testMapToMethodParameters

 /**
  * Test converting a map to a set of method parameters.
  * @param array $map the map of parameter names to values
  * @param array $expected the expected array of parameter values
  * @covers MapUtils::MapToMethodParameters
  * @dataProvider MapToMethodParametersProvider
  */
 public function testMapToMethodParameters(array $map, array $expected)
 {
     $reflectionClass = new ReflectionClass($this);
     $reflectionMethod = $reflectionClass->getMethod('SampleMethod');
     $result = MapUtils::MapToMethodParameters($map, $reflectionMethod);
     $this->assertEquals($expected, $result);
 }
开发者ID:sambavade,项目名称:google-api-adwords-php,代码行数:14,代码来源:MapUtilsTest.php

示例12: DfpUser

require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the LineItemService.
    $lineItemService = $user->GetService('LineItemService', 'v201411');
    // Set the IDs of the custom fields, custom field option, and line item.
    $customFieldId = "INSERT_CUSTOM_FIELD_ID_HERE";
    $dropDownCustomFieldId = "INSERT_DROP_DOWN_CUSTOM_FIELD_ID_HERE";
    $customFieldOptionId = "INSERT_CUSTOM_FIELD_OPTION_ID_HERE";
    $lineItemId = "INSERT_LINE_ITEM_ID_HERE";
    // Create a statement to select a single line item by ID.
    $vars = MapUtils::GetMapEntries(array('id' => new NumberValue($lineItemId)));
    $filterStatement = new Statement("WHERE id = :id ORDER BY id ASC LIMIT 1", $vars);
    // Get the line item.
    $page = $lineItemService->getLineItemsByStatement($filterStatement);
    $lineItem = $page->results[0];
    // Create custom field values.
    $customFieldValues = array();
    $customFieldValue = new CustomFieldValue();
    $customFieldValue->customFieldId = $customFieldId;
    $customFieldValue->value = new TextValue("Custom field value");
    $customFieldValues[] = $customFieldValue;
    $dropDownCustomFieldValue = new DropDownCustomFieldValue();
    $dropDownCustomFieldValue->customFieldId = $dropDownCustomFieldId;
    $dropDownCustomFieldValue->customFieldOptionId = $customFieldOptionId;
    $customFieldValues[] = $dropDownCustomFieldValue;
    // Only add existing custom field values for different custom fields than
开发者ID:nicholasscottfish,项目名称:googleads-php-lib,代码行数:31,代码来源:SetLineItemCustomFieldValue.php

示例13: dirname

// $path = '/path/to/dfp_api_php_lib/src';
$path = dirname(__FILE__) . '/../../../../src';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the CompanyService.
    $companyService = $user->GetService('CompanyService', 'v201408');
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('type' => new TextValue('ADVERTISER')));
    // Create a statement to only select companies that are advertisers sorted
    // by name.
    $filterStatement = new Statement("WHERE type = :type ORDER BY name LIMIT 500", $vars);
    // Get companies by statement.
    $page = $companyService->getCompaniesByStatement($filterStatement);
    // Display results.
    if (isset($page->results)) {
        $i = $page->startIndex;
        foreach ($page->results as $company) {
            print $i . ') Company with ID "' . $company->id . '", name "' . $company->name . '", and type "' . $company->type . "\" was found.\n";
            $i++;
        }
    }
    print 'Number of results found: ' . $page->totalResultSetSize . "\n";
} catch (OAuth2Exception $e) {
开发者ID:planetfitnessnational,项目名称:googleads-php-lib,代码行数:31,代码来源:GetCompaniesByStatement.php

示例14: set_include_path

set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
require_once 'Google/Api/Ads/Common/Util/MapUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the UserService.
    $userService = $user->GetService('UserService', 'v201306');
    // Set the ID of the user to deactivate.
    $userId = 'INSERT_USER_ID_HERE';
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('id' => new NumberValue($userId)));
    // Create statement text to get user by id.
    $filterStatementText = "WHERE id = :id";
    $offset = 0;
    do {
        // Create statement to page through results.
        $filterStatement = new Statement($filterStatementText . " LIMIT 500 OFFSET " . $offset, $vars);
        // Get users by statement.
        $page = $userService->getUsersByStatement($filterStatement);
        // Display results.
        $userIds = array();
        if (isset($page->results)) {
            $i = $page->startIndex;
            foreach ($page->results as $usr) {
                print $i . ') User with ID "' . $usr->id . '", email "' . $usr->email . '", and status "' . ($usr->isActive ? 'ACTIVE' : 'INACTIVE') . "\" will be deactivated.\n";
                $i++;
开发者ID:venkyanthony,项目名称:google-api-dfp-php,代码行数:31,代码来源:DeactivateUserExample.php

示例15: set_include_path

set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'Google/Api/Ads/Dfp/Lib/DfpUser.php';
require_once dirname(__FILE__) . '/../../../Common/ExampleUtils.php';
require_once 'Google/Api/Ads/Dfp/Util/DateTimeUtils.php';
try {
    // Get DfpUser from credentials in "../auth.ini"
    // relative to the DfpUser.php file's directory.
    $user = new DfpUser();
    // Log SOAP XML request and response.
    $user->LogDefaults();
    // Get the OrderService.
    $orderService = $user->GetService('OrderService', 'v201308');
    // Create a datetime representing today.
    $today = date(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT, strtotime('now'));
    // Create bind variables.
    $vars = MapUtils::GetMapEntries(array('today' => new TextValue($today)));
    // Create statement text to get all draft and pending approval orders that
    // haven't ended and aren't archived.
    $filterStatementText = "WHERE status IN ('DRAFT', 'PENDING_APPROVAL') " . "AND endDateTime >= :today " . "AND isArchived = FALSE ";
    $offset = 0;
    do {
        // Create statement to page through results.
        $filterStatement = new Statement($filterStatementText . " LIMIT 500 OFFSET " . $offset, $vars);
        // Get orders by statement.
        $page = $orderService->getOrdersByStatement($filterStatement);
        // Display results.
        $orderIds = array();
        if (isset($page->results)) {
            $i = $page->startIndex;
            foreach ($page->results as $order) {
                // Archived orders cannot be approved.
开发者ID:venkyanthony,项目名称:google-api-dfp-php,代码行数:31,代码来源:ApproveOrdersExample.php


注:本文中的MapUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。