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


PHP Utility::beginsWith方法代码示例

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


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

示例1: beforeSave

 public function beforeSave()
 {
     parent::beforeSave();
     if ($this->isNewRecord) {
         // custom qr code
         if ($this->qr_type == 'custom') {
             $this->dot = 'QrTagDotSquare';
             $this->frame_dot = 'QrTagFrameDotSquare';
             $this->frame = 'QrTagFrameSquare';
             $this->dotColor = '000000';
             $this->frame_dotColor = '000000';
             $this->frameColor = '000000';
             $this->backgroundColor = 'ffffff';
         }
         $this->created_at = new CDbExpression('NOW()');
         $this->updated_at = new CDbExpression('NOW()');
         $this->show_in_gallery = 0;
         /*
         $url = $this->getSystem_tag_url();
         if(Utility::isBitlyActive()) {
             if($bitlyUrl = Utility::getBitlyUrl($url)) {
                 $url = $bitlyUrl;
             }
         }
         
         $this->tag_url = $url;
         */
     } else {
         $this->updated_at = new CDbExpression('NOW()');
     }
     // get only related attributes according to the QR Type and refill the serialized data attribute
     if (is_array($this->data)) {
         $newData = array();
         foreach ($this->data as $attribute => $value) {
             if (Utility::beginsWith($attribute, $this->type . '_data')) {
                 $newData[$this->type][substr($attribute, strlen($this->type . '_data') + 1)] = $value;
             }
         }
         $newData = array_map('strip_tags', array_pop($newData));
         $this->data = serialize(array($newData));
     }
     return true;
 }
开发者ID:priyranjansingh,项目名称:getleads,代码行数:43,代码来源:Qr.php

示例2: actionTag

 public function actionTag()
 {
     // set theme
     $theme_name = 'mobile';
     Yii::app()->theme = $theme_name;
     #####################################################################################################
     $id = Yii::app()->request->getParam('id');
     $id = Utility::getIDFromTag($id);
     $qr = $this->loadModel($id);
     if ($qr->user->is_active == 0) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $log = new Log();
     $log->qr_id = $id;
     Yii::app()->session['mqr_id'] = $id;
     $log->save();
     switch ($qr->type) {
         case 'website':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'facebook_profile':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'twitter_profile':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'twitter_status':
             if (preg_match('@^(https?://)?(www\\.)?twitter\\.com@', strtolower($qr->qrData->tweet))) {
                 if (!Utility::beginsWith(strtolower($qr->qrData->tweet), 'http://') && !Utility::beginsWith(strtolower($qr->qrData->tweet), 'https://')) {
                     Yii::app()->request->redirect('http://' . $qr->qrData->tweet);
                 }
                 Yii::app()->request->redirect($qr->qrData->tweet);
             } else {
                 Yii::app()->request->redirect('http://twitter.com/home?status=' . urlencode($qr->qrData->tweet));
             }
             break;
         case 'linkedin_profile':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'linkedin_share':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'telephone':
             header('Location: tel:' . $qr->qrData->number);
             exit;
         case 'email':
             header('Location: mailto:' . $qr->qrData->email);
             exit;
         case 'email_msg':
             header('Location: mailto:' . $qr->qrData->email . '?subject=' . $qr->qrData->subject . '&body=' . $qr->qrData->body);
             exit;
         case 'sms':
             header('Location: sms:' . $qr->qrData->number);
             exit;
     }
     $model = new Email();
     if (isset($_POST['Email'])) {
         $model->attributes = $_POST['Email'];
         $model->ip = $_SERVER['REMOTE_ADDR'];
         $model->timestamp = date("Y-m-d H:m:s");
         $model->browser = Yii::app()->wurfl->device->getCapability('mobile_browser');
         $model->created_at = date("Y-m-d H:m:s");
         if (empty($model->browser)) {
             $browser = new EWebBrowser();
             $model->browser = $browser->browser;
         }
         if ($model->save()) {
             Yii::app()->user->setFlash('contact', 'Thank you for contacting us.');
             $this->redirect(Yii::app()->request->getParam('id'));
         }
     }
     $this->render('tag', array('qr' => $qr, 'model' => $model));
 }
开发者ID:priyranjansingh,项目名称:getleads,代码行数:73,代码来源:QrController.php

示例3: installedShapes

 public static function installedShapes()
 {
     $path = getcwd() . DIRECTORY_SEPARATOR . "shapes" . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR;
     $out = array();
     // get all dots
     $i = 0;
     $shapes = glob($path . 'QrTagDot*.png');
     foreach ($shapes as $shape) {
         $filename = pathinfo($shape, PATHINFO_FILENAME);
         $out['dots'][$filename == 'QrTagDotSquare' ? count($shapes) + 1 : $i++] = $filename;
     }
     // get all frames
     $shapes = glob($path . 'QrTagFrame*.png');
     $i = 0;
     $ii = 0;
     foreach ($shapes as $shape) {
         $filename = pathinfo($shape, PATHINFO_FILENAME);
         if (Utility::beginsWith($filename, 'QrTagFrameDot')) {
             //                $out['frame_dots'][$i++] = $filename;
             $out['frame_dots'][$filename == 'QrTagFrameDotSquare' ? count($shapes) + 1 : $i++] = $filename;
         } else {
             //                $out['frames'][$ii++] = $filename;
             $out['frames'][$filename == 'QrTagFrameSquare' ? count($shapes) + 1 : $ii++] = $filename;
         }
     }
     krsort($out['dots']);
     krsort($out['frame_dots']);
     krsort($out['frames']);
     return $out;
 }
开发者ID:gdbhosale,项目名称:fancy-qr-code-generator,代码行数:30,代码来源:QrTag.php

示例4: actionTag

 public function actionTag()
 {
     // set theme
     $theme_name = 'mobile';
     Yii::app()->theme = $theme_name;
     #####################################################################################################
     $id = Yii::app()->request->getParam('id');
     $id = Utility::getIDFromTag($id);
     $qr = $this->loadModel($id);
     if ($qr->user->is_active == 0) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $log = new Log();
     $log->qr_id = $id;
     $log->save();
     switch ($qr->type) {
         case 'website':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'facebook_profile':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'twitter_profile':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'twitter_status':
             if (preg_match('@^(https?://)?(www\\.)?twitter\\.com@', strtolower($qr->qrData->tweet))) {
                 if (!Utility::beginsWith(strtolower($qr->qrData->tweet), 'http://') && !Utility::beginsWith(strtolower($qr->qrData->tweet), 'https://')) {
                     Yii::app()->request->redirect('http://' . $qr->qrData->tweet);
                 }
                 Yii::app()->request->redirect($qr->qrData->tweet);
             } else {
                 Yii::app()->request->redirect('http://twitter.com/home?status=' . urlencode($qr->qrData->tweet));
             }
             break;
         case 'linkedin_profile':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'linkedin_share':
             Yii::app()->request->redirect($qr->qrData->url);
             break;
         case 'telephone':
             header('Location: tel:' . $qr->qrData->number);
             exit;
         case 'email':
             header('Location: mailto:' . $qr->qrData->email);
             exit;
         case 'email_msg':
             header('Location: mailto:' . $qr->qrData->email . '?subject=' . $qr->qrData->subject . '&body=' . $qr->qrData->body);
             exit;
         case 'sms':
             header('Location: sms:' . $qr->qrData->number);
             exit;
     }
     $this->render('tag', array('qr' => $qr));
 }
开发者ID:priyranjansingh,项目名称:getleads,代码行数:56,代码来源:QrController-origional.php


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