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


PHP tools类代码示例

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


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

示例1: updateIdealo

 public function updateIdealo()
 {
     $tools = new tools();
     $tools->AllNeeded();
     $communication = new Communication($this->login);
     $count = count($this->update);
     $update = 0;
     $interval = $this->login['pagesize'];
     if ($count < $this->login['pagesize']) {
         $interval = $count;
     }
     while ($count > 0) {
         $tools->getXMLBegin($this->login['testmode']);
         for ($i = $update; $i < $update + $interval; $i++) {
             if ($this->update[$i]['event'] == 'DELETE') {
                 $tools->deleteProductAtIdealo($this->update[$i]['product']);
             } else {
                 $tools->getXML($this->update[$i]['product']);
             }
         }
         @$communication->sendRequest($tools->xml->saveXML());
         $count = $count - $this->login['pagesize'];
         $update = $update + $this->login['pagesize'];
     }
 }
开发者ID:shophelfer,项目名称:shophelfer.com-shop,代码行数:25,代码来源:idealo_realtime.php

示例2: validate

 public function validate($value)
 {
     if (is_array($value) && isset($value['path']) && isset($value['dataURL'])) {
         $fileName = str_replace('..', '', $value['path']);
         /* secure relative path */
         /* find an unused name */
         $fileInfo = pathinfo($fileName);
         $base = $fileInfo['filename'];
         $ext = $fileInfo['extension'];
         $dir = empty($fileInfo['dirname']) ? '' : $fileInfo['dirname'] . '/';
         /*  $fileInfo['dirname'] in case that filename contains a part of dirname */
         $path = PROFILE_PATH . $this->entity->getModule() . '/' . $this->path . '/';
         $nbn = 0;
         while (is_file($path . $fileName)) {
             $fileName = $dir . $base . '_' . $nbn . '.' . $ext;
             $nbn++;
         }
         if (!is_dir($path . $dir)) {
             \tools::createDirectory($path . $fileInfo['dirname'] . '/');
         }
         /* decode dataURL */
         $cut = explode(',', $value['dataURL']);
         $dataURL = $cut[1];
         $dataURL = base64_decode(str_replace(' ', '+', $dataURL));
         /* save and check image */
         if (file_put_contents($path . $fileName, $dataURL)) {
             return $fileName;
         } else {
             return FALSE;
             /* can't write image */
         }
     } else {
         return parent::validate($value);
     }
 }
开发者ID:saitinet,项目名称:parsimony,代码行数:35,代码来源:file.php

示例3: onMove

 public function onMove($typeProgress, $module, $name, $copy = FALSE)
 {
     $imgs = $this->getConfig('img');
     foreach ($imgs as $img) {
         $oldPath = $img['name'];
         $imagePath = substr(strstr($oldPath, '/files/'), 7);
         $newPath = $module . '/files/' . $imagePath;
         if ($oldPath !== $newPath) {
             if (stream_resolve_include_path($newPath) !== FALSE) {
                 /* check if an image with this path already exists in profile */
                 $fileInfo = pathinfo($imagePath);
                 $extension = strtolower($fileInfo['extension']);
                 $filename = $fileInfo['filename'];
                 /* allow to not overload filename with name_0_3_2_0 ... */
                 $generatedPart = strrchr($filename, '_');
                 if ($generatedPart !== FALSE && is_numeric(substr($generatedPart, 1))) {
                     $filename = substr($fileInfo['filename'], 0, -strlen($generatedPart));
                 }
                 $nbn = 0;
                 while (stream_resolve_include_path($newPath)) {
                     $imagePath = $filename . '_' . $nbn . '.' . $extension;
                     $newPath = $module . '/files/' . $imagePath;
                     $nbn++;
                 }
             }
             $this->setConfig('imgPath', $newPath);
             \tools::file_put_contents(PROFILE_PATH . $newPath, file_get_contents($oldPath, FILE_USE_INCLUDE_PATH));
         }
     }
 }
开发者ID:saitinet,项目名称:parsimony,代码行数:30,代码来源:block.php

示例4: findAndAdd

 public static function findAndAdd($title, $classify, $logid)
 {
     $title = zmf::filterInput($title, 't', 1);
     if (!$title) {
         return false;
     }
     $info = Tags::model()->find('title=:title AND classify=:classify', array(':title' => $title, ':classify' => $classify));
     if (!$info) {
         if (Yii::app()->session['checkHasBadword'] == 'yes') {
             $status = Posts::STATUS_STAYCHECK;
         } else {
             $status = Posts::STATUS_PASSED;
         }
         unset(Yii::app()->session['checkHasBadword']);
         $_data = array('title' => $title, 'name' => tools::pinyin($title), 'classify' => $classify, 'status' => $status, 'cTime' => time(), 'length' => mb_strlen($title, 'GBK'));
         $modelB = new Tags();
         $modelB->attributes = $_data;
         if ($modelB->save()) {
             $tagid = $modelB->id;
         }
     } else {
         $tagid = $info['id'];
     }
     if ($tagid && $logid) {
         $_info = TagRelation::model()->find('tagid=:tagid AND logid=:logid AND classify=:classify', array(':tagid' => $tagid, ':logid' => $logid, ':classify' => $classify));
         if (!$_info) {
             $_tagre = array('tagid' => $tagid, 'logid' => $logid, 'classify' => $classify, 'cTime' => zmf::now());
             $modelC = new TagRelation();
             $modelC->attributes = $_tagre;
             $modelC->save();
         }
     }
     return $tagid;
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:34,代码来源:Tags.php

示例5: validate

 public function validate($value)
 {
     $length = strlen($value);
     if ($length >= $this->characters_min && $length <= $this->characters_max) {
         if (empty($value)) {
             $title = $this->entity->getField($this->entity->getBehaviorTitle());
             if (!$this->required) {
                 return '';
             } elseif (!empty($title->value)) {
                 return \tools::sanitizeString($title->value);
             } else {
                 return FALSE;
             }
         } else {
             $args = func_get_args();
             if ($this->unique && isset($args[1])) {
                 if ($args[1] === 'insert') {
                     $args[1] = FALSE;
                 }
                 if ($this->checkUniqueAction($value, $args[1]) === FALSE) {
                     return FALSE;
                 }
             }
             return filter_var($value, FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '#' . $this->regex . '#')));
         }
     }
     return FALSE;
 }
开发者ID:saitinet,项目名称:parsimony,代码行数:28,代码来源:url_rewriting.php

示例6: actionExrates

 /**
  * 获取汇率
  * 雅虎YQL https://developer.yahoo.com/yql/console/
  * 请求语句 select * from yahoo.finance.xchange where pair="CNYUSD,CNYHKD"
  * 示例 https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%3D%22CNYUSD%2CCNYHKD%22%0A%09%09&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env&callback=
  */
 public function actionExrates()
 {
     $units = tools::getUnits();
     unset($units['CNY']);
     $arr = array();
     foreach ($units as $k => $v) {
         $arr[] = 'CNY' . $k;
     }
     $str = join(',', $arr);
     $url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%3D%22{$str}%22%0A%09%09&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env&callback=";
     $output = zmf::curlget($url);
     if (!$output) {
         exit('Failed');
     }
     $rateArr = CJSON::decode($output);
     $rateArr = $rateArr['query']['results']['rate'];
     foreach ($rateArr as $val) {
         $_key = str_replace('CNY', '', $val['id']);
         $rates[$_key] = array('rate' => $val['Rate'], 'title' => tools::getUnits($_key));
     }
     $detailDir = Yii::app()->basePath . '/runtime/rates/';
     zmf::createUploadDir($detailDir);
     $dir = $detailDir . 'detail.log';
     file_put_contents($dir, CJSON::encode($rates));
     exit('well done');
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:32,代码来源:CronController.php

示例7: getData

     private static function getData($serverData, $lang){
	  try{
               $stops = array();
               $html = str_get_html($serverData);
               $nodes = $html->find("tr.rowHeightTraject");
               $i = 0;
               foreach ($nodes as $node) {
                    $row_delay = str_replace("'",'',str_replace('+','',trim($node->children(3)->first_child()->plaintext)));
                    if (isset($row_delay)) {
                         $arr= array();
                         $arr = explode(":",$row_delay);
                         if(isset($arr[1])){
                              $delay = (60*$arr[0] + $arr[1])*60;
                         }else{
                              $delay = $row_delay * 60;
                         }
                    } else {
                         $delay = 0;
                    }
                    $stops[$i] = new Stop();
                    $stops[$i]->station = stations::getStationFromRTName($node->children(1)->first_child()->plaintext,$lang);
                    $stops[$i]->delay = $delay;
                    $stops[$i]->time = tools::transformTime("00d" . $node->children(2)->first_child()->plaintext . ":00", date("Ymd"));
                    $i++;
               }
	       return $stops;
	  }
	  catch(Exception $e){
	       throw new Exception($e->getMessage(), 500);
	  }
     }
开发者ID:GMLudo,项目名称:iRail,代码行数:31,代码来源:vehicleinformation.php

示例8: selectTrain

function selectTrain()
{
    $conn = tools::connectDatabase();
    $data = array();
    $ID = array();
    $employeeCount = array();
    $result = mysqli_query($conn, "SELECT * FROM Training");
    while ($row = mysqli_fetch_array($result)) {
        array_push($data, $row);
        array_push($ID, $row[0]);
    }
    for ($x = 0; $x < count($ID); $x++) {
        $newID = $ID[$x];
        $employeeCount[$newID] = 0;
    }
    $newResult = mysqli_query($conn, "SELECT * FROM EmployeeTraining");
    while ($newRow = mysqli_fetch_array($newResult)) {
        for ($i = 0; $i < count($ID); $i++) {
            if ($ID[$i] == $newRow['TrainingID']) {
                $newID = $ID[$i];
                $employeeCount[$newID]++;
            }
        }
    }
    for ($z = 0; $z < count($data); $z++) {
        $tempID = $data[$z]['TrainingID'];
        $data[$z]['count'] = $employeeCount[$tempID];
    }
    echo json_encode($data);
}
开发者ID:anymost,项目名称:EmployeeManager,代码行数:30,代码来源:selectTrain.php

示例9: addRole

function addRole($roleName, $roleAuthority)
{
    $conn = tools::connectDatabase();
    $roleID = tools::getMaxRoleID() + 1;
    mysqli_query($conn, "INSERT INTO Roles(RoleID,RoleName,Auth_Authority,Auth_Info,Auth_Job,Auth_Attendance,Auth_Training,Auth_Evaluation,Auth_RP,Auth_Role,Auth_Encrypt) VALUES ('{$roleID}','{$roleName}','{$roleAuthority['0']}','{$roleAuthority['1']}','{$roleAuthority['2']}','{$roleAuthority['3']}','{$roleAuthority['4']}','{$roleAuthority['5']}','{$roleAuthority['6']}','{$roleAuthority['7']}','{$roleAuthority['8']}')");
    echo "success";
}
开发者ID:anymost,项目名称:EmployeeManager,代码行数:7,代码来源:addRole.php

示例10: _element

 /**
  *  HELPER METHODS
  */
 public static function _element($class = null, $content = null, $args = array())
 {
     if (is_null($content)) {
         $content = isset($args['content']) ? $args['content'] : '';
     }
     return tools::load('html', 'elements/base', array('class' => self::_class($class, $args), 'id' => isset($args['id']) ? $args['id'] : '', 'title' => isset($args['title']) ? $args['title'] : '', 'icon' => isset($args['icon']) ? $args['icon'] : false, 'label' => isset($args['label']) ? $args['label'] : false, 'mobile' => isset($args['mobile']) ? $args['mobile'] : 'icon', 'compact' => isset($args['compact']) ? $args['compact'] : false, 'url' => isset($args['url']) ? $args['url'] : false, 'content' => $content));
 }
开发者ID:dmak78,项目名称:panel-bar,代码行数:10,代码来源:build.php

示例11: selectAuthority

function selectAuthority($authority)
{
    $conn = tools::connectDatabase();
    $allData = array();
    $employeeID = array();
    $result = mysqli_query($conn, "SELECT RoleID,RoleName FROM Roles WHERE {$authority}='1' ");
    while ($row = mysqli_fetch_array($result)) {
        array_push($allData, array('roleID' => $row['RoleID'], 'roleName' => $row['RoleName']));
    }
    for ($i = 0; $i < count($allData); $i++) {
        $roleID = $allData[$i]["roleID"];
        $result = mysqli_query($conn, "SELECT EmployeeID FROM UserRole WHERE RoleID='{$roleID}'");
        while ($row = mysqli_fetch_array($result)) {
            array_push($employeeID, $row['EmployeeID']);
        }
    }
    $employee = array();
    for ($i = 0; $i < count($employeeID); $i++) {
        $id = $employeeID[$i];
        $result = mysqli_query($conn, "SELECT EmployeeID,EmployeeName,DepartmentID,Title From Employees WHERE EmployeeID='{$id}'");
        while ($row = mysqli_fetch_array($result)) {
            array_push($employee, $row);
        }
    }
    array_push($allData, $employee);
    echo json_encode($allData);
}
开发者ID:anymost,项目名称:EmployeeManager,代码行数:27,代码来源:getSelectAuthority.php

示例12: fontPaths

 /**
  *  FONTS
  */
 private function fontPaths($css)
 {
     $fonts = array(array('{{FA}}', tools::font('fontawesome-webfont.woff?v=4.2', false)), array('{{SSP400}}', tools::font('sourcesanspro-400.woff')), array('{{SSP600}}', tools::font('sourcesanspro-600.woff')), array('{{SSPitalic}}', tools::font('sourcesanspro-400-italic.woff')));
     foreach ($fonts as $font) {
         $css = str_ireplace($font[0], $font[1], $css);
     }
     return $css;
 }
开发者ID:dmak78,项目名称:panel-bar,代码行数:11,代码来源:assets.php

示例13: setContent

 public function setContent($html)
 {
     if (\app::getClass('user')->VerifyConnexion() && $_SESSION['permissions'] & 128) {
         /* perm 128 = configure blocks */
         return \tools::file_put_contents(PROFILE_PATH . $this->getConfig('viewPath'), \tools::sanitize($html));
     }
     return FALSE;
 }
开发者ID:saitinet,项目名称:parsimony,代码行数:8,代码来源:block.php

示例14: load_configs

 public static function load_configs()
 {
     global $config;
     $files = tools::find_files(CONFIG_PATH, "*.php");
     foreach ($files as $file) {
         include_once $file;
     }
 }
开发者ID:gyc2015,项目名称:gycphp,代码行数:8,代码来源:tools.class.php

示例15: getEmployeeInformation

function getEmployeeInformation($userID)
{
    $conn = tools::connectDatabase();
    $result = mysqli_query($conn, "SELECT * FROM Employees WHERE EmployeeID='{$userID}'");
    while ($row = mysqli_fetch_array($result)) {
        echo json_encode($row);
    }
}
开发者ID:anymost,项目名称:EmployeeManager,代码行数:8,代码来源:getEmployeeInformation.php


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