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


PHP AF::path方法代码示例

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


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

示例1: getContent

 public function getContent()
 {
     $modelName = strtolower(get_class($this));
     $file = AF::path($this->view, array('application', 'views', 'widgets', $modelName));
     $this->before();
     ob_start();
     @(include $file);
     return ob_get_clean();
 }
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: saveCsvCustom

 public static function saveCsvCustom($array, $fulfillmentModel, $path = array('files', 'csv'))
 {
     $file = AF::path($fulfillmentModel->csvFileName, $path, 'csv');
     $current = "";
     $delim = $fulfillmentModel->fulfillment_delimiter;
     foreach ($array as $item) {
         $i = 0;
         foreach ($item as $value) {
             if ($i) {
                 $current .= $delim;
             }
             $current .= '"' . $value . '"';
             $i++;
         }
         $current .= "\n";
     }
     file_put_contents($file, $current);
     return $file;
 }
开发者ID:,项目名称:,代码行数:19,代码来源:

示例3: downloadFromFulfillment

 public function downloadFromFulfillment()
 {
     $arrayCsvFiles = array();
     $arrayCsvFilesClear = array();
     $sql = "SELECT *\n                FROM `fulfillment_files`\n                WHERE `fulfillment_id`=?i";
     $result = self::$_msql->getInd('filename', $sql, $this->fulfillment_id);
     if ($this->ssl) {
         $sftp = new Net_SFTP($this->server);
         if (!$sftp->login($this->username, $this->password)) {
             exit('Login Failed');
         }
         //$contents = $sftp->nlist("{$this->download_path}");
         $dPath = trim($this->download_path, '/');
         $contents = $sftp->nlist("{$dPath}");
         if (!$contents) {
             return;
         }
         foreach ($contents as $file) {
             if (substr($file, -4, 4) == '.csv') {
                 $arrayCsvFiles[] = $arrayCsvFilesClear[] = $file;
             }
         }
         foreach ($arrayCsvFiles as $file) {
             $tF = explode('/', $file);
             $fName = array_pop($tF);
             if (isset($result["{$fName}"])) {
                 continue;
             }
             $downloadFilePath = AF::path(time() . rand(1, 1000), array('files', 'csv', 'temp'), 'csv');
             if ($sftp->get($dPath . '/' . $file, $downloadFilePath)) {
                 self::parserCsvFiles($downloadFilePath);
                 $sql = "INSERT INTO `fulfillment_files` (`fulfillment_id`, `filename`, `time`) VALUES (?i, ?s, NOW())";
                 self::$_msql->query($sql, $this->fulfillment_id, $fName);
             }
         }
         $sftp->_disconnect(0);
     } else {
         $ftp = ftp_connect($this->server, $this->port, 300);
         if (!$ftp) {
             return;
         }
         if ($this->username && $this->password) {
             ftp_login($ftp, $this->username, $this->password);
         }
         ftp_pasv($ftp, true);
         // Passive mode
         $contents = ftp_nlist($ftp, "{$this->download_path}");
         if (!$contents) {
             return;
         }
         foreach ($contents as $file) {
             if (substr($file, -4, 4) == '.csv') {
                 $file = str_replace('\\', '/', $file);
                 $arrayCsvFiles[] = $file;
                 $tF = explode('/', $file);
                 $arrayCsvFilesClear[] = (string) trim(array_pop($tF));
             }
         }
         foreach ($arrayCsvFiles as $file) {
             $tF = explode('/', $file);
             $fName = (string) trim(array_pop($tF));
             if (isset($result["{$fName}"])) {
                 continue;
             }
             $downloadFilePath = AF::path(time() . rand(1, 1000), array('files', 'csv', 'temp'), 'csv');
             if (ftp_get($ftp, $downloadFilePath, $file, FTP_ASCII)) {
                 self::parserCsvFiles($downloadFilePath);
                 $sql = "INSERT INTO `fulfillment_files` (`fulfillment_id`, `filename`, `time`) VALUES (?i, ?s, NOW())";
                 self::$_msql->query($sql, $this->fulfillment_id, $fName);
             }
         }
         ftp_close($ftp);
     }
     $sql = "DELETE FROM `fulfillment_files`\n                WHERE `fulfillment_id` = ?i\n                AND `filename` NOT IN (?a)";
     self::$_msql->query($sql, $this->fulfillment_id, $arrayCsvFilesClear);
 }
开发者ID:,项目名称:,代码行数:76,代码来源:

示例4: FIND_IN_SET

 $soapUrl = "https://secure-wms.com/webserviceexternal/contracts.asmx";
 $xml = '';
 $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n<soap:Body>\n<extLoginData xmlns=\"http://www.JOI.com/schemas/ViaSub.WMS/\">\n<ThreePLKey>" . $key . "</ThreePLKey>\n<Login>" . $username . "</Login>\n<Password>" . $password . "</Password>\n<FacilityID>" . $warehouseId . "</FacilityID>\n</extLoginData>\n<orders xmlns=\"http://www.JOI.com/schemas/ViaSub.WMS/\">";
 // grab the packages
 $sql = "\n\tSELECT \n\t\t  distinct p.package_id\n\t\t, p.customer_id\n\tFROM \n\t\tpackages p\n\t\tjoin packages_orders po on po.package_id = p.package_id\n\t\tjoin orders o on o.order_id = po.order_id\n\tWHERE \n\t\tp.sent is null\n\t\tand p.fulfillment_id = ?i\n\t\t#AND FIND_IN_SET('test', `o`.`flags`)=0";
 $packages = $msql->getInd('package_id', $sql, $fulfillmentModel->fulfillment_id);
 foreach ($packages as $p) {
     $package = new Package();
     $package->loadFullPackage($p['package_id']);
     $xml .= $package->getPackage3pl();
     unset($package);
 }
 $xml .= "</orders>\n<warnings xmlns=\"http://www.JOI.com/schemas/ViaSub.WMS/\">string</warnings>\n</soap:Body>\n</soap:Envelope>";
 //fb($xml);
 $path = array('files', 'csv');
 $filePath = AF::path($fulfillmentModel->csvFileName, $path, 'xml');
 file_put_contents($filePath, $xml);
 echo $filePath . '<br><br>';
 // M.Scully - disabled this by passing ?test in the url
 if (!isset($_GET['test'])) {
     // send to 3PL
     $headers = array("Content-type: text/xml;charset=\"utf-8\"", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: http://www.JOI.com/schemas/ViaSub.WMS/CreateOrders", "Content-length: " . strlen($xml));
     //SOAPAction: your op URL
     // PHP cURL  for https connection with auth
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($ch, CURLOPT_URL, $soapUrl);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     //curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of the doc
     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
开发者ID:,项目名称:,代码行数:31,代码来源:

示例5: _key_exchange


//.........这里部分代码省略.........
     $keyBytes = $key->toBytes(true);
     $this->exchange_hash = pack('Na*Na*Na*Na*Na*Na*Na*Na*', strlen($this->identifier), $this->identifier, strlen($this->server_identifier), $this->server_identifier, strlen($kexinit_payload_client), $kexinit_payload_client, strlen($kexinit_payload_server), $kexinit_payload_server, strlen($this->server_public_host_key), $this->server_public_host_key, strlen($eBytes), $eBytes, strlen($fBytes), $fBytes, strlen($keyBytes), $keyBytes);
     $this->exchange_hash = $kexHash->hash($this->exchange_hash);
     if ($this->session_id === false) {
         $this->session_id = $this->exchange_hash;
     }
     for ($i = 0; $i < count($server_host_key_algorithms) && !in_array($server_host_key_algorithms[$i], $this->server_host_key_algorithms); $i++) {
     }
     if ($i == count($server_host_key_algorithms)) {
         user_error('No compatible server host key algorithms found');
         return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED);
     }
     if ($public_key_format != $server_host_key_algorithms[$i] || $this->signature_format != $server_host_key_algorithms[$i]) {
         user_error('Server Host Key Algorithm Mismatch');
         return $this->_disconnect(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED);
     }
     $packet = pack('C', NET_SSH2_MSG_NEWKEYS);
     if (!$this->_send_binary_packet($packet)) {
         return false;
     }
     $response = $this->_get_binary_packet();
     if ($response === false) {
         user_error('Connection closed by server');
         return false;
     }
     extract(unpack('Ctype', $this->_string_shift($response, 1)));
     if ($type != NET_SSH2_MSG_NEWKEYS) {
         user_error('Expected SSH_MSG_NEWKEYS');
         return false;
     }
     switch ($encrypt) {
         case '3des-cbc':
             if (!class_exists('Crypt_TripleDES')) {
                 require_once AF::path('TripleDES', array('application', 'components', 'includes', 'Crypt'));
             }
             $this->encrypt = new Crypt_TripleDES();
             // $this->encrypt_block_size = 64 / 8 == the default
             break;
         case '3des-ctr':
             if (!class_exists('Crypt_TripleDES')) {
                 require_once AF::path('TripleDES', array('application', 'components', 'includes', 'Crypt'));
             }
             $this->encrypt = new Crypt_TripleDES(CRYPT_DES_MODE_CTR);
             // $this->encrypt_block_size = 64 / 8 == the default
             break;
         case 'aes256-cbc':
         case 'aes192-cbc':
         case 'aes128-cbc':
             if (!class_exists('Crypt_AES')) {
                 //require_once('Crypt/AES.php');
                 require_once AF::path('AES', array('application', 'components', 'includes', 'Crypt'));
                 //require_once(AF::path('Hash', array('application', 'components', 'includes', 'Crypt')));
             }
             $this->encrypt = new Crypt_AES();
             $this->encrypt_block_size = 16;
             // eg. 128 / 8
             break;
         case 'aes256-ctr':
         case 'aes192-ctr':
         case 'aes128-ctr':
             if (!class_exists('Crypt_AES')) {
                 require_once AF::path('AES', array('application', 'components', 'includes', 'Crypt'));
             }
             $this->encrypt = new Crypt_AES(CRYPT_AES_MODE_CTR);
             $this->encrypt_block_size = 16;
             // eg. 128 / 8
开发者ID:,项目名称:,代码行数:67,代码来源:

示例6: substr

    if (strlen($order['expiry_date']) == 4) {
        $expiry_date[] = substr($order['expiry_date'], 0, 2);
        $expiry_date[] = '20' . substr($order['expiry_date'], 2, 2);
    } elseif (strlen($order['expiry_date']) == 3) {
        $expiry_date[] = '0' . substr($order['expiry_date'], 0, 1);
        $expiry_date[] = '20' . substr($order['expiry_date'], 1, 2);
    } else {
        $expiry_date[] = '00';
        $expiry_date[] = '0000';
    }
    $expiryDate = implode('/', $expiry_date);
    $csv[] = array($order['order_id'], date("d/m/Y"), 'HHCRBM', $order['product_name'], '', '', $order['fname'], $order['lname'], $order['address1'], $order['address2'], $order['city'], $order['country_name'], $order['zip'], $order['phone'], '', $order['email'], sprintf("%02d", substr($order['created'], 8, 2)) . '/' . sprintf("%02d", substr($order['created'], 5, 2)) . '/' . sprintf("%02d", substr($order['created'], 0, 4)), 'Credit', $arrayNote1['ccn'], $expiryDate, '', '', $arrayNote1['ccc'], 'rocket', '1');
}
$name = 'lj3out_rocket_' . date('Ymdhis');
$path = array('files', 'csv', 'rockets');
$filePath = Csv::saveCsv($csv, $name, $path);
$fileZipPath = AF::path($name, $path, 'zip');
$phpFilePath = AF::path('zip', $path);
system('/usr/bin/php ' . $phpFilePath . ' name=' . $name . ' > /dev/null 2>&1 &');
$sftp = new Net_SFTP($option['server']);
if (!$sftp->login($option['username'], $option['password'])) {
    exit('Login Failed');
}
if (!$sftp->put($sftp->pwd() . $option['uploadPath'] . $name . '.zip', $fileZipPath, NET_SFTP_LOCAL_FILE)) {
    echo 'error';
    die;
}
$sql = "UPDATE `orders` SET `rocket` = 2\n        WHERE `order_id` IN (?a)";
$msql->query($sql, $orderIDs);
unlink($fileZipPath);
unlink($filePath);
开发者ID:,项目名称:,代码行数:31,代码来源:

示例7: render

 public function render($file, $vars = array())
 {
     $pathArray = array('application', 'views');
     $mainPath = implode(DIRECTORY_SEPARATOR, $pathArray) . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $this->layout) . '.php';
     if (!is_array($file)) {
         $controllerPath = $this->controller;
         array_push($pathArray, $controllerPath);
     } else {
         $tempPath = $file;
         $file = array_pop($tempPath);
         $pathArray = array_merge($pathArray, $tempPath);
     }
     $bodyPath = AF::path($file, $pathArray);
     $params = array('access' => $this->access, 'controller' => $this->controller, 'action' => $this->action, 'user' => $this->user);
     $allParams = array_merge($vars, $params);
     $body = $this->view->render($bodyPath, $allParams);
     $paramsResult = array('body' => $body, 'pageTitle' => $this->pageTitle);
     $this->setMainVars($paramsResult);
     $mainParams = $this->mainParams;
     $result = $this->view->render($mainPath, $mainParams);
     $this->fc->setBody($result);
 }
开发者ID:,项目名称:,代码行数:22,代码来源:

示例8: Package

     $package = new Package();
     $package->loadFullPackage($p['package_id']);
     $orderRows = array_merge($orderRows, $package->getPackageCustom($fulfillmentModel, $firstRow));
     unset($package);
     $firstRow = false;
 }
 //var_dump($orderRows); exit;
 if (!$orderRows) {
     continue;
 }
 $filePath = Csv::saveCsvCustom($orderRows, $fulfillmentModel);
 echo $filePath . '<br>';
 // do we need to zip the file?
 if ($fulfillmentModel->fulfillment_zip) {
     $phpFilePath = AF::path('zip', array('files', 'csv'));
     $fp = AF::path('', array('files', 'csv'));
     system('/usr/bin/php-cli ' . $phpFilePath . ' ' . $fulfillmentModel->csvFileName . ' ' . $fp . ' > /home/pinnacle/er4.txt');
     $filePath = $fp . $fulfillmentModel->csvFileName . '.zip';
     echo $filePath . '<br>';
 }
 // M.Scully - disabled this by passing ?test in the url
 if (!isset($_GET['test'])) {
     $fulfillmentModel->filePath = $filePath;
     if ($fulfillmentModel->uploadToFulfillment()) {
         foreach ($packages as $p) {
             $package = new Package();
             $package->loadPackage($p['package_id']);
             $package->packageSent();
             unset($package);
         }
     }
开发者ID:,项目名称:,代码行数:31,代码来源:

示例9: includeArray

 public function includeArray($fileName, $pathArray)
 {
     $path = AF::path($fileName, $pathArray);
     return include $path;
 }
开发者ID:,项目名称:,代码行数:5,代码来源:

示例10: find_file

 public static function find_file($fileName, $pathArray, $ext = NULL)
 {
     $path = AF::path($fileName, $pathArray, $ext);
     if (file_exists($path)) {
         return $path;
     }
     return FALSE;
 }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例11: exit

    exit('does not have files');
}
echo '<pre>';
print_r($contents);
echo '</pre>';
foreach ($contents as $file) {
    if (substr($file, -4, 4) == '.csv') {
        $arrayCsvFiles[] = $arrayCsvFilesClear[] = $file;
    }
}
foreach ($arrayCsvFiles as $file) {
    if (isset($result["{$file}"])) {
        continue;
    }
    $localFileNeme = time() . rand(1, 1000);
    $downloadFilePath = AF::path($localFileNeme, array('files', 'csv', 'rockets'), 'csv');
    if ($sftp->get($dPath . '/' . $file, $downloadFilePath)) {
        parse_csv_file($downloadFilePath);
        $sql = "INSERT INTO `fulfillment_files` (`fulfillment_id`, `filename`, `time`) VALUES (?i, ?s, NOW())";
        $msql->query($sql, $fulfillmentID, $file);
    }
}
$sftp->_disconnect(0);
function parse_csv_file($downloadFilePath)
{
    global $fulfillmentID, $msql;
    $header = NULL;
    $data = array();
    if (($handle = fopen($downloadFilePath, 'r')) !== FALSE) {
        while (($row = fgetcsv($handle, 1000, ',')) !== FALSE) {
            if (!$header) {
开发者ID:,项目名称:,代码行数:31,代码来源:


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