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


PHP Convert::raw2SQL方法代码示例

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


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

示例1: executePaste

 public function executePaste($id, $view = '', $ini = 'development')
 {
     $paste_dir = '/code';
     $jail_dir = '/opt/codepad';
     if (!$view) {
         $view = 'html_body';
     }
     $file = "{$paste_dir}/{$id}";
     if (file_exists("{$jail_dir}/{$file}")) {
         $gearman = new GearmanClient();
         $gearman->addServer();
         $paste = DataObject::get_one('Paste', 'Filename = \'' . Convert::raw2SQL($id) . '\'');
         if (!$paste) {
             echo 'Paste not found';
             die;
         }
         $func = $paste->PHPVersion()->FuncName;
         $options['path'] = $file;
         $options['headers'] = $this->emu_getallheaders();
         $query = $_GET;
         unset($query['url']);
         $query = http_build_query($query);
         $options['query_string'] = $query;
         $options['method'] = $_SERVER['REQUEST_METHOD'];
         // Attempt 1 of 3 - Fetch request body from STDIN via php://input
         $options['body'] = file_get_contents('php://input');
         if ($_SERVER['CONTENT_LENGTH'] > 0 && !$options['body']) {
             // Attempt 2 of 3 - Fetch request body via PECL_HTTP extension
             $options['body'] = http_get_request_body();
             // Attempt 3 of 3 - Reconstruct request body from $_POST and $_FILES
             if (!$options['body']) {
                 list($mime, $boundary) = explode('boundary=', $_SERVER['CONTENT_TYPE']) + array('', '');
                 if ($boundary) {
                     foreach ($_POST as $name => $value) {
                         $options['body'] .= "--{$boundary}\r\nContent-Disposition: form-data; name=\"{$name}\"\r\n\r\n{$value}\r\n";
                     }
                     foreach ($_FILES as $name => $file) {
                         $content = '||BASE64-BINARY||' . base64_encode(file_get_contents($file['tmp_name'])) . '||BASE64-BINARY||';
                         $type = $file['type'];
                         $length = $file['size'];
                         $origname = $file['name'];
                         $options['body'] .= "--{$boundary}\r\nContent-Disposition: form-data; name=\"{$name}\"; filename=\"{$origname}\"\r\nContent-Type: {$type}\r\nContent-Length: {$length}\r\nContent-Transfer-Encoding: binary\r\n\r\n{$content}\r\n";
                     }
                     $options['body'] .= "--{$boundary}";
                 }
             }
         }
         $options['ini'] = $ini;
         switch ($view) {
             case 'request_headers':
                 echo '<pre>';
                 foreach ($options['headers'] as $header => $value) {
                     echo "{$header}: {$value}\r\n";
                 }
                 echo '</pre>';
                 die;
             case 'request_body':
                 echo $options['body'];
                 die;
             case 'opcodes':
                 $func = 'VLD';
                 //						$options['version'] = $paste->PHPVersion()->Path;
                 break;
             case 'profile':
                 echo 'Not yet implemented';
                 die;
             case 'call_graph':
                 echo 'Not yet implemented';
                 die;
         }
         $res = $gearman->do($func, json_encode($options));
         $result = (array) json_decode($res);
         if (empty($result['headers'])) {
             // No headers, treat as error response
             if (!empty($result['errors'])) {
                 echo $result['errors'];
                 die;
             }
             if (strpos($result['body'], 'timelimit: sending warning signal 15') !== FALSE) {
                 var_dump($result);
                 echo "Time limit exceeded.";
             } elseif ($view != 'opcodes') {
                 echo "Invalid HTTP Response from server, received:<br/>\n<pre>";
                 var_dump($res);
                 echo "</pre>";
                 die;
             }
         }
         $headers = base64_decode($result['headers']);
         $body = base64_decode($result['body']);
         switch ($view) {
             case 'html_body':
                 foreach (explode("\r\n", $headers) as $header) {
                     header($header);
                 }
                 echo $body;
                 die;
             case 'response_body':
                 echo "<pre>{$body}</pre>";
                 die;
//.........这里部分代码省略.........
开发者ID:jemmy655,项目名称:Deployable-PHP-Codepad,代码行数:101,代码来源:PHPVersion.php

示例2: selectedNewsletterCategory

 function selectedNewsletterCategory()
 {
     if (Director::urlParam("ID")) {
         $param = Director::urlParam("ID");
         if ((int) $param > 0) {
             return DataObject::get_by_id("NewsletterCategory", (int) $param);
         }
         if ($category = DataObject::get_one("NewsletterCategory", "Title LIKE '" . Convert::raw2SQL($param) . "'")) {
             return $category;
         }
     }
     return DataObject::get("NewsletterCategory");
 }
开发者ID:pstaender,项目名称:Newsletter,代码行数:13,代码来源:NewsletterHolder.php

示例3: doSubmitInvoiceAddress

 function doSubmitInvoiceAddress($data, $form)
 {
     $session = ShopOrder::orderSession();
     if (!($contact = DataObject::get_by_id("ShopAddress", $session->InvoiceAddressID))) {
         $contact = new ShopAddress();
     }
     if (isset($data['ThisIsShippingAddress'])) {
         if (!($shipping = DataObject::get_by_id("ShopAddress", $session->DeliveryAddressID))) {
             $shipping = new ShopAddress();
         }
         $form->saveInto($shipping);
         $shipping->OrderID = $session->ID;
         $shipping->write();
         $session->DeliveryAddressID = $shipping->ID;
         $session->write();
         return $this->redirectToNextStepFrom("deliveryaddress");
     } else {
         $form->saveInto($contact);
         $contact->OrderID = $session->ID;
         $contact->write();
         $session->InvoiceAddressID = $contact->ID;
         $session->write();
     }
     if ($member = $session->Client()) {
         //insert firtsname + surname to member
         if (!$member->FirstName) {
             $member->FirstName = Convert::raw2SQL($data['FirstName']);
         }
         if (!$member->Surname) {
             $member->Surname = Convert::raw2SQL($data['Surname']);
         }
         if (!$member->Country) {
             $member->Country = Convert::raw2SQL($data['Country']);
         }
         if ($member->Gender == "-") {
             $member->Gender = Convert::raw2SQL($data['Gender']);
         }
         $member->write();
     }
     if (isset($data['UseContactForShipping'])) {
         if (!($shipping = DataObject::get_by_id("ShopAddress", $session->DeliveryAddressID))) {
             $shipping = new ShopAddress();
         }
         $form->saveInto($shipping);
         $shipping->OrderID = $session->ID;
         $shipping->write();
         $session->DeliveryAddressID = $shipping->ID;
         $session->write();
         return $this->redirectToNextStepFrom("deliveryaddress");
     } else {
         return $this->redirectToNextStepFrom("invoiceaddress");
     }
 }
开发者ID:pstaender,项目名称:ShopSystem,代码行数:53,代码来源:ShopCheckoutPage.php


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