• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Convert类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testInvalidMap

 /**
  * @return void
  */
 public function testInvalidMap()
 {
     $this->setExpectedException('Exception');
     $handler = new Convert('[dummy]');
     $record = $this->getMock('Migration\\ResourceModel\\Record', [], [], '', false);
     $record2 = $this->getMockBuilder('Migration\\ResourceModel\\Record')->disableOriginalConstructor()->getMock();
     $handler->handle($record, $record2, 'dummy');
 }
开发者ID:Mohitsahu123,项目名称:data-migration-tool-ce,代码行数:11,代码来源:ConvertTest.php


示例2: AddCompanyStatus

 public function AddCompanyStatus($arg = false)
 {
     $model = $this->model;
     $arrayobject = $model->AddCompanyStatus($arg);
     $ObjectDTO = new Convert();
     $companies = $ObjectDTO->toObject($arrayobject);
     $this->View->msg = $companies;
     $this->View->render('places_Ive_searched/index');
 }
开发者ID:Smeltvig,项目名称:PHP-MVC,代码行数:9,代码来源:places_Ive_searched.php


示例3: doUpload

 public function doUpload()
 {
     $id = $_POST['id'];
     $duration = $_POST['duration'];
     $sn = $_POST['sn'];
     $isLast = $_POST['last'];
     $mysql = new DbMysql();
     $dashfile = new DashFile($id, $sn);
     $convert = new Convert($dashfile);
     if ($isLast == 1) {
         if (!$mysql->connect()) {
             return "ERROR: Sql server connect error!\n";
         }
         if (!$mysql->updateStatus($id, '1')) {
             return "ERROR: Sql INSERT error\n";
         }
         $segCount = $mysql->geSgmsCount($id);
         $dpl = new DashPlaylist($dashfile);
         $dpl->generateMPD($duration, 0, $segCount);
         $dpl->generateM3U8($segCount);
         $mysql->close();
     } else {
         if (!$dashfile->isValid()) {
             return "ERROR: File is invalid!\n";
         }
         if ($dashfile->saveFile()) {
             if (!$mysql->connect()) {
                 return "ERROR: Sql server connect error!\n";
             }
             if ($sn == 0) {
                 $mysql->insertNewVideo($id, $sn, $id, $duration);
             } else {
                 $mysql->updateNumSegs($id, $sn);
             }
             $mysql->close();
         } else {
             return "ERROR: File save error!\n";
         }
         if ($convert->doConvert()) {
             if (!$mysql->connect()) {
                 return "ERROR: Sql server connect error!\n";
             }
             if (!$mysql->updateNumConverted($id, $sn)) {
                 return "ERROR: Sql UPDATE error\n";
             }
             $mysql->close();
         }
         $start = $sn - 1;
         //if ($sn >= 3) {
         //    $start = $sn - 2;
         //}
         $dpl = new DashPlaylist($dashfile);
         $dpl->generateMPD($duration, $start, $sn);
     }
     return "SUCCESS";
 }
开发者ID:xueerk,项目名称:Moblie-MPEG-DASH-Player,代码行数:56,代码来源:ServerController.class.php


示例4: curl_func

 public function curl_func()
 {
     $data = $_POST;
     //Set destination URL
     $url = "http://localhost/SwipeContest/index.php/Welcome";
     $tst = new Convert();
     $result = $tst->cURLSnippet($url, $data);
     print_r($result);
     echo "POST data forwarded via cURL to " . $url;
 }
开发者ID:kulgee001,项目名称:SwipeContest,代码行数:10,代码来源:Test.php


示例5: formatValue

 protected function formatValue($record, $source, $info)
 {
     // Field sources
     //if(is_string($source)) {
     $val = Convert::raw2xml($record->{$source});
     //} else {
     //	$val = $record->val($source[0], $source[1]);
     //}
     // Casting, a la TableListField.  We're deep-calling a helper method on TableListField that
     // should probably be pushed elsewhere...
     if (!empty($info['casting'])) {
         $val = TableListField::getCastedValue($val, $info['casting']);
     }
     // Formatting, a la TableListField
     if (!empty($info['formatting'])) {
         $format = str_replace('$value', "__VAL__", $info['formatting']);
         $format = preg_replace('/\\$([A-Za-z0-9-_]+)/', '$record->$1', $format);
         $format = str_replace('__VAL__', '$val', $format);
         $val = eval('return "' . $format . '";');
     }
     $prefix = empty($info['newline']) ? "" : "<br>";
     $classClause = "";
     if (isset($info['title'])) {
         $cssClass = preg_replace('/[^A-Za-z0-9]+/', '', $info['title']);
         $classClause = "class=\"{$cssClass}\"";
     }
     if (isset($info['link']) && $info['link']) {
         $link = $info['link'] === true && $record->hasMethod('CMSEditLink') ? $record->CMSEditLink() : $info['link'];
         return $prefix . "<a {$classClause} href=\"{$link}\">{$val}</a>";
     } else {
         return $prefix . "<span {$classClause}>{$val}</span>";
     }
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:33,代码来源:SideReport.php


示例6: load

 public function load($request)
 {
     $response = new SS_HTTPResponse();
     $response->addHeader('Content-Type', 'application/json');
     $response->setBody(Convert::array2json(call_user_func($this->source, $request->getVar('val'))));
     return $response;
 }
开发者ID:spekulatius,项目名称:silverstripe-bootstrap_extra_fields,代码行数:7,代码来源:BootstrapTypeaheadField.php


示例7: Field

    public function Field($properties = array())
    {
        $content = '';
        Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js');
        Requirements::javascript(FRAMEWORK_DIR . "/javascript/ToggleField.js");
        if ($this->startClosed) {
            $this->addExtraClass('startClosed');
        }
        $valforInput = $this->value ? Convert::raw2att($this->value) : "";
        $rawInput = Convert::html2raw($valforInput);
        if ($this->charNum) {
            $reducedVal = substr($rawInput, 0, $this->charNum);
        } else {
            $reducedVal = DBField::create_field('Text', $rawInput)->{$this->truncateMethod}();
        }
        // only create togglefield if the truncated content is shorter
        if (strlen($reducedVal) < strlen($rawInput)) {
            $content = <<<HTML
\t\t\t<div class="readonly typography contentLess" style="display: none">
\t\t\t\t{$reducedVal}
\t\t\t\t&nbsp;<a href="#" class="triggerMore">{$this->labelMore}</a>
\t\t\t</div>
\t\t\t<div class="readonly typography contentMore">
\t\t\t\t{$this->value}
\t\t\t\t&nbsp;<a href="#" class="triggerLess">{$this->labelLess}</a>
\t\t\t</div>\t
\t\t\t<br />
\t\t\t<input type="hidden" name="{$this->name}" value="{$valforInput}" />
HTML;
        } else {
            $this->dontEscape = true;
            $content = parent::Field();
        }
        return $content;
    }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:35,代码来源:ToggleField.php


示例8: Field

 function Field()
 {
     $XML_title = $this->allowHTML ? $this->title : Convert::raw2xml($this->title);
     // extraclass
     $XML_class = $this->extraClass() ? " class=\"{$this->extraClass()}\"" : '';
     return "<h{$this->headingLevel}{$XML_class}>{$XML_title}</h{$this->headingLevel}>";
 }
开发者ID:ramziammar,项目名称:websites,代码行数:7,代码来源:HeaderField.php


示例9: notifySubscribers

 /**
  * Send email to subscribers, notifying them the thread has been created or post added.
  */
 public function notifySubscribers()
 {
     // all members id except current user
     $member_id = Member::currentUserID();
     $list = DataObject::get("Forum_Subscribers", "\"ForumID\" = '" . $this->owner->ForumID . "' AND \"MemberID\" != '{$member_id}'");
     if ($list) {
         foreach ($list as $obj) {
             $SQL_id = Convert::raw2sql((int) $obj->MemberID);
             // Get the members details
             $member = DataObject::get_one("Member", "\"Member\".\"ID\" = '{$SQL_id}'");
             if ($member) {
                 //error_log("email sent ".$member->Email);
                 $type = $obj->Type;
                 switch ($type) {
                     // send all email notification
                     case 'all':
                         $this->createEmail($member);
                         break;
                         // send new thread only email notification
                     // send new thread only email notification
                     case 'thread':
                         //if($this->owner->isFirstPost()){
                         $this->createEmail($member);
                         //}
                         break;
                         //
                     //
                     default:
                         break;
                 }
             }
         }
     }
 }
开发者ID:liquidedge,项目名称:forum_subscribe,代码行数:37,代码来源:ForumPostEmailSubscribers.php


示例10: requireDefaultRecords

 /**
  *	The process to automatically construct data object output configurations, executed on project build.
  */
 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     // Grab the list of data objects that have been completely removed.
     foreach (DB::getConn()->tableList() as $table) {
         // Delete existing output configurations for these data objects.
         if (!class_exists($table)) {
             $existing = DataObjectOutputConfiguration::get_one('DataObjectOutputConfiguration', "IsFor = '" . Convert::raw2sql($table) . "'");
             $this->deleteConfiguration($table, $existing);
         }
     }
     // Grab the list of all data object types, along with any inclusions/exclusions defined.
     $objects = ClassInfo::subclassesFor('DataObject');
     $inclusions = self::$custom_inclusions;
     $exclusions = array_unique(array_merge(self::$exclusions, self::$custom_exclusions));
     // Check existing output configurations for these data objects.
     foreach ($objects as $object) {
         $existing = DataObjectOutputConfiguration::get_one('DataObjectOutputConfiguration', "IsFor = '" . Convert::raw2sql($object) . "'");
         // Delete existing output configurations for invalid data objects, or for those excluded.
         if ($existing && (self::$disabled || get_parent_class($object) !== 'DataObject' || ClassInfo::classImplements($object, 'TestOnly') || count($inclusions) > 0 && !in_array($object, $inclusions) || count($inclusions) === 0 && in_array($object, $exclusions))) {
             $this->deleteConfiguration($object, $existing);
         } else {
             if (!$existing && !self::$disabled && get_parent_class($object) === 'DataObject' && !ClassInfo::classImplements($object, 'TestOnly') && (count($inclusions) > 0 && in_array($object, $inclusions) || count($inclusions) === 0 && !in_array($object, $exclusions))) {
                 $this->addConfiguration($object);
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:nglasl-silverstripe-apiwesome,代码行数:31,代码来源:DataObjectOutputConfiguration.php


示例11: addtocart

 /**
  * Handles form submission
  * @param array $data
  * @return bool|\SS_HTTPResponse
  */
 public function addtocart(array $data)
 {
     $groupedProduct = $this->getController()->data();
     if (empty($data) || empty($data['Product']) || !is_array($data['Product'])) {
         $this->sessionMessage(_t('GroupedCartForm.EMPTY', 'Please select at least one product.'), 'bad');
         $this->extend('updateErrorResponse', $this->request, $response, $groupedProduct, $data, $this);
         return $response ? $response : $this->controller->redirectBack();
     }
     $cart = ShoppingCart::singleton();
     foreach ($data['Product'] as $id => $prodReq) {
         if (!empty($prodReq['Quantity']) && $prodReq['Quantity'] > 0) {
             $prod = Product::get()->byID($id);
             if ($prod && $prod->exists()) {
                 $saveabledata = !empty($this->saveablefields) ? Convert::raw2sql(array_intersect_key($data, array_combine($this->saveablefields, $this->saveablefields))) : $prodReq;
                 $buyable = $prod;
                 if (isset($prodReq['Attributes'])) {
                     $buyable = $prod->getVariationByAttributes($prodReq['Attributes']);
                     if (!$buyable || !$buyable->exists()) {
                         $this->sessionMessage("{$prod->InternalItemID} is not available with the selected options.", "bad");
                         $this->extend('updateErrorResponse', $this->request, $response, $groupedProduct, $data, $this);
                         return $response ? $response : $this->controller->redirectBack();
                     }
                 }
                 if (!$cart->add($buyable, (int) $prodReq['Quantity'], $saveabledata)) {
                     $this->sessionMessage($cart->getMessage(), $cart->getMessageType());
                     $this->extend('updateErrorResponse', $this->request, $response, $groupedProduct, $data, $this);
                     return $response ? $response : $this->controller->redirectBack();
                 }
             }
         }
     }
     $this->extend('updateGroupCartResponse', $this->request, $response, $groupedProduct, $data, $this);
     return $response ? $response : ShoppingCart_Controller::direct($cart->getMessageType());
 }
开发者ID:helpfulrobot,项目名称:markguinn-silverstripe-shop-groupedproducts,代码行数:39,代码来源:GroupedCartForm.php


示例12: perform

 public function perform()
 {
     set_time_limit(0);
     $log = new DeploynautLogFile($this->args['logfile']);
     $projects = DNProject::get()->filter('Name', Convert::raw2sql($this->args['projectName']));
     $project = $projects->first();
     $path = $project->getLocalCVSPath();
     $env = $this->args['env'];
     $log->write('Starting git fetch for project "' . $project->Name . '"');
     // if an alternate user has been configured for clone, run the command as that user
     // @todo Gitonomy doesn't seem to have any way to prefix the command properly, if you
     // set 'sudo -u composer git' as the "command" parameter, it tries to run the whole
     // thing as a single command and fails
     $user = DNData::inst()->getGitUser();
     if (!empty($user)) {
         $command = sprintf('cd %s && sudo -u %s git fetch -p origin +refs/heads/*:refs/heads/* --tags', $path, $user);
         $process = new \Symfony\Component\Process\Process($command);
         $process->setEnv($env);
         $process->setTimeout(3600);
         $process->run();
         if (!$process->isSuccessful()) {
             throw new RuntimeException($process->getErrorOutput());
         }
     } else {
         $repository = new Gitonomy\Git\Repository($path, array('environment_variables' => $env));
         $repository->run('fetch', array('-p', 'origin', '+refs/heads/*:refs/heads/*', '--tags'));
     }
     $log->write('Git fetch is finished');
 }
开发者ID:antons-,项目名称:deploynaut,代码行数:29,代码来源:FetchJob.php


示例13: dosave

 /**
  * Form action handler for ContactInquiryForm.
  *
  * @param array $data The form request data submitted
  * @param Form $form The {@link Form} this was submitted on
  */
 function dosave(array $data, Form $form, SS_HTTPRequest $request)
 {
     $SQLData = Convert::raw2sql($data);
     $attrs = $form->getAttributes();
     if ($SQLData['Comment'] != '' || $SQLData['Url'] != '') {
         // most probably spam - terminate silently
         Director::redirect(Director::baseURL() . $this->URLSegment . "/success");
         return;
     }
     $item = new ContactInquiry();
     $form->saveInto($item);
     // $form->sessionMessage(_t("ContactPage.FORMMESSAGEGOOD", "Your inquiry has been submitted. Thanks!"), 'good');
     $item->write();
     $mailFrom = $this->currController->MailFrom ? $this->currController->MailFrom : $SQLData['Email'];
     $mailTo = $this->currController->MailTo ? $this->currController->MailTo : Email::getAdminEmail();
     $mailSubject = $this->currController->MailSubject ? $this->currController->MailSubject . ' - ' . $SQLData['Ref'] : _t('ContactPage.SUBJECT', '[web] New contact inquiry - ') . ' ' . $data['Ref'];
     $email = new Email($mailFrom, $mailTo, $mailSubject);
     $email->replyTo($SQLData['Email']);
     $email->setTemplate("ContactInquiry");
     $email->populateTemplate($SQLData);
     $email->send();
     // $this->controller->redirectBack();
     if ($email->send()) {
         $this->controller->redirect($this->controller->Link() . "success");
     } else {
         $this->controller->redirect($this->controller->Link() . "error");
     }
     return false;
 }
开发者ID:helpfulrobot,项目名称:jelicanin-silverstripe-contact-page,代码行数:35,代码来源:ContactInquiryForm.php


示例14: load

 public function load($request)
 {
     $response = new SS_HTTPResponse();
     $response->addHeader('Content-Type', 'application/json');
     $response->setBody(Convert::array2json(array("_memberID" => Member::currentUserID())));
     return $response;
 }
开发者ID:spekulatius,项目名称:silverstripe-bootstrap_extra_fields,代码行数:7,代码来源:KeepAliveField.php


示例15: MetaTags

 /**
  * Return the title, description, keywords and language metatags.
  * 
  * @todo Move <title> tag in separate getter for easier customization and more obvious usage
  * 
  * @param boolean|string $includeTitle Show default <title>-tag, set to false for custom templating
  * @return string The XHTML metatags
  */
 public function MetaTags($includeTitle = true)
 {
     $tags = "";
     if ($includeTitle === true || $includeTitle == 'true') {
         $tags .= "<title>" . Convert::raw2xml($this->Title) . "</title>\n";
     }
     $generator = trim(Config::inst()->get('SiteTree', 'meta_generator'));
     if (!empty($generator)) {
         $tags .= "<meta name=\"generator\" content=\"" . Convert::raw2att($generator) . "\" />\n";
     }
     $charset = Config::inst()->get('ContentNegotiator', 'encoding');
     $tags .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset={$charset}\" />\n";
     if ($this->MetaDescription) {
         $tags .= "<meta name=\"description\" content=\"" . Convert::raw2att($this->MetaDescription) . "\" />\n";
     }
     if ($this->ExtraMeta) {
         $tags .= $this->ExtraMeta . "\n";
     }
     if (Permission::check('CMS_ACCESS_CMSMain') && in_array('CMSPreviewable', class_implements($this)) && !$this instanceof ErrorPage) {
         $tags .= "<meta name=\"x-page-id\" content=\"{$this->ID}\" />\n";
         $tags .= "<meta name=\"x-cms-edit-link\" content=\"" . $this->CMSEditLink() . "\" />\n";
     }
     $this->extend('MetaTags', $tags);
     return $tags;
 }
开发者ID:i-lateral,项目名称:silverstripe-catalogue,代码行数:33,代码来源:CatalogueController.php


示例16: Presentations

 function Presentations()
 {
     $Speaker = NULL;
     if (isset($_GET['key'])) {
         $key = Convert::raw2sql($_GET['key']);
         $username = SchedSpeaker::HashToUsername($key);
         $Speaker = SchedSpeaker::get()->filter('username', $username)->first();
     } elseif ($speakerID = Session::get('UploadMedia.SpeakerID')) {
         $Speaker = SchedSpeaker::get()->byID($speakerID);
     }
     // Speaker not found
     if (!$Speaker) {
         return $this->httpError(404, 'Sorry, that does not appear to be a valid token.');
     }
     Session::set('UploadMedia.SpeakerID', $Speaker->ID);
     $Presentations = $Speaker->PresentationsForThisSpeaker();
     // No presentations
     if (!$Presentations) {
         return $this->httpError(404, 'Sorry, it does not appear that you have any presentations.');
     }
     // IF there's only one presentation with no media, go ahead and forward to it's page
     if ($Presentations->count() == 1 && !$Presentations->first()->UploadedMedia()) {
         $PresentationID = $Presentations->first()->ID;
         $this->redirect($this->link() . 'Upload/' . $PresentationID);
         return;
     }
     $data["Speaker"] = $Speaker;
     $data["Presentations"] = $Presentations;
     return $this->Customise($data);
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:30,代码来源:SchedToolsPage.php


示例17: testPublish

 /**
  * @todo Test the results of a publication better
  */
 function testPublish()
 {
     $page1 = $this->objFromFixture('Page', "page1");
     $page2 = $this->objFromFixture('Page', "page2");
     $this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
     $response = $this->get("admin/cms/publishall?confirm=1");
     $this->assertContains(sprintf(_t('CMSMain.PUBPAGES', "Done: Published %d pages"), 30), $response->getBody());
     // Some modules (e.g., cmsworkflow) will remove this action
     if (isset(CMSBatchActionHandler::$batch_actions['publish'])) {
         $response = Director::test("admin/cms/batchactions/publish", array('csvIDs' => implode(',', array($page1->ID, $page2->ID)), 'ajax' => 1), $this->session());
         $responseData = Convert::json2array($response->getBody());
         $this->assertTrue(property_exists($responseData['modified'], $page1->ID));
         $this->assertTrue(property_exists($responseData['modified'], $page2->ID));
     }
     // Get the latest version of the redirector page
     $pageID = $this->idFromFixture('RedirectorPage', 'page5');
     $latestID = DB::query('select max("Version") from "RedirectorPage_versions" where "RecordID"=' . $pageID)->value();
     $dsCount = DB::query('select count("Version") from "RedirectorPage_versions" where "RecordID"=' . $pageID . ' and "Version"=' . $latestID)->value();
     $this->assertEquals(1, $dsCount, "Published page has no duplicate version records: it has " . $dsCount . " for version " . $latestID);
     $this->session()->clear('loggedInAs');
     //$this->assertRegexp('/Done: Published 4 pages/', $response->getBody())
     /*
     $response = Director::test("admin/publishitems", array(
     	'ID' => ''
     	'Title' => ''
     	'action_publish' => 'Save and publish',
     ), $session);
     $this->assertRegexp('/Done: Published 4 pages/', $response->getBody())
     */
 }
开发者ID:rixrix,项目名称:silverstripe-cms,代码行数:33,代码来源:CMSMainTest.php


示例18: handle

    /**
     * @param IQuerySpecification $specification
     * @return IQueryResult
     */
    public function handle(IQuerySpecification $specification)
    {
        $params = $specification->getSpecificationParams();
        $current_date = @$params['name_pattern'];
        $date_filter = "";
        if ($current_date) {
            $current_date = Convert::raw2sql($current_date);
            $date_filter = "AND (\n                                    (\n                                        (DATE('{$current_date}') < TrainingCourseScheduleTime.EndDate)\n                                        OR\n                                        (TrainingCourse.Online=1 AND TrainingCourseScheduleTime.StartDate IS NULL AND TrainingCourseScheduleTime.EndDate IS NULL)\n                                    )\n                                )";
        }
        $sql = <<<SQL
        SELECT C.Name AS CompanyName
        FROM TrainingCourse
        INNER JOIN CompanyService ON CompanyService.ID  = TrainingCourse.TrainingServiceID AND CompanyService.ClassName='TrainingService'
        INNER JOIN Company C on C.ID = CompanyService.CompanyID
        INNER JOIN TrainingCourseSchedule ON TrainingCourseSchedule.CourseID = TrainingCourse.ID
        LEFT JOIN TrainingCourseScheduleTime ON TrainingCourseScheduleTime.LocationID = TrainingCourseSchedule.ID
        WHERE CompanyService.Active = 1
        {$date_filter}
        GROUP BY C.Name
        ORDER BY C.Name ASC;
SQL;
        $results = DB::query($sql);
        $companies = array();
        for ($i = 0; $i < $results->numRecords(); $i++) {
            $record = $results->nextRecord();
            $company = $record['CompanyName'];
            $value = sprintf('%s', $company);
            array_push($companies, new SearchDTO($value, $value));
        }
        return new OpenStackImplementationNamesQueryResult($companies);
    }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:35,代码来源:TrainingCoursesCompanyQueryHandler.php


示例19: get_homepage_link

 /**
  * Get the full form (e.g. /home/) relative link to the home page for the current HTTP_HOST value. Note that the
  * link is trimmed of leading and trailing slashes before returning to ensure consistency.
  *
  * @return string
  */
 public static function get_homepage_link()
 {
     if (!self::$cached_homepage_link) {
         // TODO Move to 'homepagefordomain' module
         if (class_exists('HomepageForDomainExtension')) {
             $host = str_replace('www.', null, $_SERVER['HTTP_HOST']);
             $SQL_host = Convert::raw2sql($host);
             $candidates = DataObject::get('SiteTree', "\"HomepageForDomain\" LIKE '%{$SQL_host}%'");
             if ($candidates) {
                 foreach ($candidates as $candidate) {
                     if (preg_match('/(,|^) *' . preg_quote($host) . ' *(,|$)/', $candidate->HomepageForDomain)) {
                         self::$cached_homepage_link = trim($candidate->RelativeLink(true), '/');
                     }
                 }
             }
         }
         if (!self::$cached_homepage_link) {
             // TODO Move to 'translatable' module
             if (class_exists('Translatable') && Object::has_extension('SiteTree', 'Translatable') && ($link = Translatable::get_homepage_link_by_locale(Translatable::get_current_locale()))) {
                 self::$cached_homepage_link = $link;
             } else {
                 self::$cached_homepage_link = self::get_default_homepage_link();
             }
         }
     }
     return self::$cached_homepage_link;
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:33,代码来源:RootURLController.php


示例20: Field

 function Field($properties = array())
 {
     $options = '';
     $odd = 0;
     $source = $this->getSource();
     foreach ($source as $key => $value) {
         // convert the ID to an HTML safe value (dots are not replaced, as they are valid in an ID attribute)
         $itemID = $this->id() . '_' . preg_replace('/[^\\.a-zA-Z0-9\\-\\_]/', '_', $key);
         if ($key == $this->value) {
             $useValue = false;
             $checked = " checked=\"checked\"";
         } else {
             $checked = "";
         }
         $odd = ($odd + 1) % 2;
         $extraClass = $odd ? "odd" : "even";
         $extraClass .= " val" . preg_replace('/[^a-zA-Z0-9\\-\\_]/', '_', $key);
         $disabled = $this->disabled || in_array($key, $this->disabledItems) ? "disabled=\"disabled\"" : "";
         $ATT_key = Convert::raw2att($key);
         $options .= "<li class=\"" . $extraClass . "\"><input id=\"{$itemID}\" name=\"{$this->name}\" type=\"radio\" value=\"{$key}\"{$checked} {$disabled} class=\"radio\" /> <label title=\"{$ATT_key}\" for=\"{$itemID}\">{$value}</label></li>\n";
     }
     // Add "custom" input field
     $value = $this->value && !array_key_exists($this->value, $this->source) ? $this->value : null;
     $checked = $value ? " checked=\"checked\"" : '';
     $options .= "<li class=\"valCustom\">" . sprintf("<input id=\"%s_custom\" name=\"%s\" type=\"radio\" value=\"__custom__\" class=\"radio\" %s />", $itemID, $this->name, $checked) . sprintf('<label for="%s_custom">%s:</label>', $itemID, _t('MemberDatetimeOptionsetField.Custom', 'Custom')) . sprintf("<input class=\"customFormat\" name=\"%s_custom\" value=\"%s\" />\n", $this->name, $value) . sprintf("<input type=\"hidden\" class=\"formatValidationURL\" value=\"%s\" />", $this->Link() . '/validate');
     $options .= $value ? sprintf('<span class="preview">(%s: "%s")</span>', _t('MemberDatetimeOptionsetField.Preview', 'Preview'), Zend_Date::now()->toString($value)) : '';
     $options .= sprintf('<a class="cms-help-toggle" href="#%s">%s</a>', $this->id() . '_Help', _t('MemberDatetimeOptionsetField.TOGGLEHELP', 'Toggle formatting help'));
     $options .= "<div id=\"" . $this->id() . "_Help\">";
     $options .= $this->getFormattingHelpText();
     $options .= "</div>";
     $options .= "</li>\n";
     $id = $this->id();
     return "<ul id=\"{$id}\" class=\"optionset {$this->extraClass()}\">\n{$options}</ul>\n";
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:34,代码来源:MemberDatetimeOptionsetField.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ConvertUtil类代码示例发布时间:2022-05-23
下一篇:
PHP Conversation类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap