/** * Adds a new ad unit to a publisher ad client. * * @param $service Google_Service_AdSenseHost AdSenseHost service object on * which to run the requests. * @param $accountId string the ID for the publisher account to be used. * @param $adClientId string the ID for the ad client to be used. * @return Google_Service_AdSenseHost_AdUnit the created ad unit. */ public static function run($service, $accountId, $adClientId) { $separator = str_repeat('=', 80) . "\n"; print $separator; printf("Adding ad unit to ad client %s\n", $adClientId); print $separator; $adUnit = new Google_Service_AdSenseHost_AdUnit(); $adUnit->setName('Ad Unit #' . getUniqueName()); $contentAdsSettings = new Google_Service_AdSenseHost_AdUnitContentAdsSettings(); $backupOption = new Google_Service_AdSenseHost_AdUnitContentAdsSettingsBackupOption(); $backupOption->setType('COLOR'); $backupOption->setColor('ffffff'); $contentAdsSettings->setBackupOption($backupOption); $contentAdsSettings->setSize('SIZE_200_200'); $contentAdsSettings->setType('TEXT'); $adUnit->setContentAdsSettings($contentAdsSettings); $customStyle = new Google_Service_AdSenseHost_AdStyle(); $colors = new Google_Service_AdSenseHost_AdStyleColors(); $colors->setBackground('ffffff'); $colors->setBorder('000000'); $colors->setText('000000'); $colors->setTitle('000000'); $colors->setUrl('0000ff'); $customStyle->setColors($colors); $customStyle->setCorners('SQUARE'); $font = new Google_Service_AdSenseHost_AdStyleFont(); $font->setFamily('ACCOUNT_DEFAULT_FAMILY'); $font->setSize('ACCOUNT_DEFAULT_SIZE'); $customStyle->setFont($font); $adUnit->setCustomStyle($customStyle); $result = $service->accounts_adunits->insert($accountId, $adClientId, $adUnit); printf("Ad unit with ID \"%s\", type \"%s\", name \"%s\" and status \"%s\" " . "was created.\n", $result->getId(), $result->getContentAdsSettings()->getType(), $result->getName(), $result->getStatus()); print "\n"; return $result; }
/** * Updates a custom channel on a host ad client. * * @param $service Google_Service_AdSenseHost AdSenseHost service object on * which to run the requests. * @param $adClientId string the ID for the ad client to be used. * @param $customChannelId string the ID of the custom channel to be updated. * @return Google_Service_AdSenseHost_CustomChannel the updated custom channel */ public static function run($service, $adClientId, $customChannelId) { $separator = str_repeat('=', 80) . "\n"; print $separator; printf("Updating custom channel %s\n", $customChannelId); print $separator; $customChannel = new Google_Service_AdSenseHost_CustomChannel(); $customChannel->setName("Updated Custom Channel #" . getUniqueName()); $result = $service->customchannels->patch($adClientId, $customChannelId, $customChannel); printf("Custom channel with ID \"%s\" and code \"%s\" got its name updated " . "to \"%s\"\n", $result->getId(), $result->getCode(), $result->getName()); print "\n"; return $result; }
/** * Adds a URL channel to a host ad client. * * @param $service Google_Service_AdSenseHost AdSenseHost service object on * which to run the requests. * @param $adClientId string the ID for the ad client to be used. * @return Google_Service_AdSenseHost_UrlChannel the created URL channel. */ public static function run($service, $adClientId) { $separator = str_repeat('=', 80) . "\n"; print $separator; printf("Adding URL channel to ad client %s\n", $adClientId); print $separator; $urlChannel = new Google_Service_AdSenseHost_UrlChannel(); $urlChannel->setUrlPattern('www.example.com/' . getUniqueName()); $result = $service->urlchannels->insert($adClientId, $urlChannel); printf("URL channel with id \"%s\" and URL pattern \"%s\" was created.\n", $result->getId(), $result->getUrlPattern()); print "\n"; return $result; }
/** * Adds a custom channel to a host ad client. * * @param $service Google_Service_AdSenseHost AdSenseHost service object on * which to run the requests. * @param $adClientId string the ID for the ad client to be used. * @return Google_Service_AdSenseHost_CustomChannel the created custom channel */ public static function run($service, $adClientId) { $separator = str_repeat('=', 80) . "\n"; print $separator; printf("Adding custom channel to ad client %s\n", $adClientId); print $separator; $customChannel = new Google_Service_AdSenseHost_CustomChannel(); $customChannel->setName('Sample Channel #' . getUniqueName()); $result = $service->customchannels->insert($adClientId, $customChannel); printf("Custom channel with ID \"%s\", code \"%s\" and name \"%s\" was " . "created.\n", $result->getId(), $result->getCode(), $result->getName()); print "\n"; return $result; }
if (!$quality) { $quality = bu::config('rc/quality'); } $width = $maxWidth; $height = $maxHeight; list($width_orig, $height_orig) = getimagesize($origName); $ratio_orig = $width_orig / $height_orig; if ($width_orig < $width and $height_orig < $height) { $width = $width_orig; $height = $height_orig; } elseif ($width / $height > $ratio_orig) { $width = $height * $ratio_orig; } else { $height = $width / $ratio_orig; } bu::lib('opt/smart_resize_image/smart_resize_image.function'); smart_resize_image($origName, $width, $height, false, $destName, false); } $name = getUniqueName($fileType); $finalDir = bu::config('rc/uploadPath') . '/' . getDirForString($name); $finalSmallDir = bu::config('rc/smallImgPath') . '/' . getDirForString($name); if (!file_exists($finalDir)) { mkdir($finalDir, 0775, true); mkdir($finalSmallDir, 0775, true); } $finalPath = bu::config('rc/uploadPath') . '/' . makePathForString($name, $fileType); $finalSmallPath = bu::config('rc/smallImgPath') . '/' . makePathForString($name, $fileType); move_uploaded_file($tmpName, $finalPath); resizeImage($finalPath, $finalSmallPath); bu::redirect('/links.php?img=' . getUrlForString($name, $fileType)); #$path = makePathForString($name, $fileType);
*/ if ($_globals['copyright']) { print $_globals['copyright_text']; } ?> #ifndef __DOM_CONSTANTS_H__ #define __DOM_CONSTANTS_H__ #include <dae/daeDomTypes.h> <?php foreach ($bag as $name => $val) { if (is_int($name)) { print $val; continue; } print "extern DLLSPEC daeString " . $name . ";\n"; } print "\n"; foreach ($_globals['elementTypes'] as $num => $val) { print "extern DLLSPEC daeString COLLADA_TYPE_" . getUniqueName($val, $_globals['elementTypes']) . ";\n"; } print "\n"; foreach ($_globals['elementNames'] as $num => $val) { print "extern DLLSPEC daeString COLLADA_ELEMENT_" . getUniqueName($val, $_globals['elementNames']) . ";\n"; } ?> #endif //__DOM_CONSTANTS_H__
print "\t\t/**< " . $bag[$typeName]['enum_documentation'][$i] . " */"; } print "\n"; $cnt++; } } } print "\t" . strtoupper($type) . "_COUNT = " . $cnt; print "\n};\n\n"; } } ?> //Element Type Enum namespace COLLADA_TYPE { const int NO_TYPE = 0, ANY = 1<?php foreach ($_globals['elementTypes'] as $num => $val) { print ",\n\t\t" . getUniqueName($val, $_globals['elementTypes']) . " = " . ($num + 2); } print ";"; ?> } // Returns the total number of schema types/dom* classes daeInt DLLSPEC colladaTypeCount(); #endif
function uploadFile($path = "uploads", $allowExt = array("gif", "jpeg", "png", "jpg", "wbmp", "blob"), $maxSize = 2097152000, $imgFlag = true) { if (!file_exists($path)) { mkdir($path); } $i = 0; $files = buildInfo(); if (!($files && is_array($files))) { return; } foreach ($files as $file) { if ($file['error'] == UPLOAD_ERR_OK) { $ext = getExtName($file['name']); //检测文件的扩展名 if (!in_array($ext, $allowExt)) { exit("非文件类型"); } //校验是否是一个真正的图片类型 if ($imgFlag) { if (!getimagesize($file['tmp_name'])) { exit("不是真正的图片类型"); } } //上传文件的大小 if ($file['size'] > $maxSize) { exit("上传文件过大"); } if (!is_uploaded_file($file['tmp_name'])) { exit("不是通过HTTP POST方式上传上来的"); } $filename = getUniqueName() . "." . $ext; $destination = $path . "/" . $filename; if (move_uploaded_file($file['tmp_name'], $destination)) { $file['name'] = $filename; unset($file['tmp_name'], $file['size'], $file['type']); $uploadedFiles[$i] = $file; $i++; } } else { switch ($file['error']) { case 1: $mes = "超过了配置文件上传文件的大小"; //UPLOAD_ERR_INI_SIZE break; case 2: $mes = "超过了表单设置上传文件的大小"; //UPLOAD_ERR_FORM_SIZE break; case 3: $mes = "文件部分被上传"; //UPLOAD_ERR_PARTIAL break; case 4: $mes = "没有文件被上传"; //UPLOAD_ERR_NO_FILE break; case 6: $mes = "没有找到临时目录"; //UPLOAD_ERR_NO_TMP_DIR break; case 7: $mes = "文件不可写"; //UPLOAD_ERR_CANT_WRITE; break; case 8: $mes = "由于PHP的扩展程序中断了文件上传"; //UPLOAD_ERR_EXTENSION break; } echo $mes; } } return $uploadedFiles; }
<?php /* * Copyright 2006 Sony Computer Entertainment Inc. * * Licensed under the MIT Open Source License, for details please see license.txt or the website * http://www.opensource.org/licenses/mit-license.php * */ if ($_globals['copyright']) { print $_globals['copyright_text']; } ?> #include <dom/domConstants.h> <?php foreach ($bag as $name => $val) { if (is_int($name)) { print $val; continue; } print "DLLSPEC daeString " . $name . " = " . $val; } print "\n"; foreach ($_globals['elementTypes'] as $num => $val) { print "DLLSPEC daeString COLLADA_TYPE_" . getUniqueName($val, $_globals['elementTypes']) . " = \"" . $val . "\";\n"; } print "\n"; foreach ($_globals['elementNames'] as $num => $val) { print "DLLSPEC daeString COLLADA_ELEMENT_" . getUniqueName($val, $_globals['elementNames']) . " = \"" . $val . "\";\n"; }
// } if ($formats['kml']) { fwrite($debug, "Guardando kml\n"); saveToGoogleFormat($_REQUEST['ROIRENDERER'], $szFileNamePol . '.kml', $mapProj, $geoProj, $debug); array_push($aSzFiles, $szFileNamePol . ".kml"); fwrite($debug, "kml guardado\n"); } // unlink($szFileName.'.dbf'); // unlink($szFileName.'.shp'); // unlink($szFileName.'.shx'); } freeShapeObjects($_REQUEST['ROIRENDERER'], $debug); fwrite($debug, 'arreglo archivos = ' . print_r($aSzFiles, true)); //download directory $sTmpDir = 'C:\\ms4w\\tmp\\ms_tmp\\'; $szFile = getUniqueName('.zip'); //compress files fwrite($debug, "Comprimiendo archos\n"); zip($aSzFiles, $sTmpDir . $szFile); fwrite($debug, "Archivos comprimidos\n"); // delete files foreach ($aSzFiles as $file) { unlink($file); } fclose($debug); //return the url of the file $result = NULL; $result->hasSelection = true; $result->value = '/ms_tmp/' . $szFile; header('Content-type: text/x-json'); header('X-JSON: true');