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


PHP Utils::getValue方法代码示例

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


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

示例1: __construct

 public function __construct($company_information, $customer_information, $filename)
 {
     $this->xml = new XMLWriter();
     $this->company_information = $company_information;
     $this->customer_information = $customer_information;
     $this->currency = Utils::getValue('currency');
     $this->parseInformation($filename);
 }
开发者ID:kawashita86,项目名称:xlsconversion,代码行数:8,代码来源:AmazonXml.php

示例2: fetchQuery

 /**
  * Creates the SQL query to fetch the data required and stores it in the appropriate internal query
  * @param array $params The parameters of the query
  * @return mixed
  */
 protected function fetchQuery(&$params)
 {
     $value = Utils::getValue($params["id"], false);
     if ($value) {
         $this->addFetchQuery($this->db->from('recent_queries')->select('*')->where('id', $value));
     } else {
         $this->addFetchQuery($this->db->from('recent_queries')->select('*')->orderBy("id DESC")->limit(8));
     }
 }
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:14,代码来源:RecentQueries.php

示例3: fetchQuery

 protected function fetchQuery(&$params)
 {
     $onlyNonEmpty = Utils::getValue($params["nonempty"], false);
     /* Query
           SELECT (site_name, site_id) FROM site
        */
     $query = $this->db->from(self::HABITAT_TABLE_NAME)->select([self::HABITAT_NAME, self::HABITAT_ID])->where('struc', 'habitat');
     if ($onlyNonEmpty) {
         $query->select("(SELECT COUNT(*) from classified\n            LEFT JOIN photo ON photo.photo_id = classified.photo_id\n            LEFT JOIN site ON photo.site_id = site.site_id\n            WHERE options.option_id = site.habitat_id) AS counted")->having("counted > 0");
     }
     /* Add the query */
     $this->addFetchQuery($query);
 }
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:13,代码来源:HabitatNamesQuery.php

示例4: show

 /**
  * Exposes passed arguments for debugging and exits.
  */
 public static function show()
 {
     $method = Utils::getValue(@$_SERVER['REQUEST_METHOD'], 'GET');
     $method = Utils::getValue(@$_SERVER['HTTP_X_HTTP_METHOD'], $method);
     if (strtolower(trim($method)) === 'get') {
         self::_headers('text/html');
         self::_html(func_get_args());
     } else {
         self::_headers('application/json');
         self::_json(func_get_args());
     }
     exit;
 }
开发者ID:rainner,项目名称:biscuit-php,代码行数:16,代码来源:Expose.php

示例5: fetchQuery

 protected function fetchQuery(&$params)
 {
     $onlyNonEmpty = Utils::getValue($params["nonempty"], false);
     /* Query
           SELECT (options_name,options_id) FROM options
        */
     $query = $this->db->from(self::OPTIONS_TABLE_NAME)->select([self::OPTION_NAME, self::OPTION_ID])->where('struc', ['mammal', 'bird', 'noanimal']);
     if ($onlyNonEmpty) {
         $query->select("(SELECT COUNT(*) from classified\n            WHERE classified.species = options.option_id) AS counted")->having("counted > 0");
     }
     /* Add the query */
     $this->addFetchQuery($query);
 }
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:13,代码来源:SpeciesNamesQuery.php

示例6: updateQuery

 protected function updateQuery(&$params)
 {
     if (!Utils::keysExist(['imageId', 'result'], $params)) {
         throw new BadMethodCallException("You need to provide a value to imageId and the" . " query result before using this method.");
     }
     /* depending on whether we are storing/updating temporary scientist results
          or results in the public table we switch the table name accordingly
        */
     $classifiedTableName = Utils::getValue($params["scientist_dataset"], false) ? self::CLASSIFIED_SCIENTIST_TABLE_NAME : self::CLASSIFIED_TABLE_NAME;
     $evennessTableName = Utils::getValue($params["scientist_dataset"], false) ? self::EVENNESS_SCIENTIST_TABLE_NAME : self::EVENNESS_TABLE_NAME;
     /* firstly delete any previous classifications for image */
     $this->db->deleteFrom($classifiedTableName)->where("photo_id", $params["imageId"])->execute();
     $this->db->deleteFrom($evennessTableName)->where("photo_id", $params["imageId"])->execute();
     $this->store();
 }
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:15,代码来源:ClassificationQuery.php

示例7: __construct

 /**
  * MammalClassifier constructor.
  * @param null $settings A settings object to run the algorithm
  * @param bool $scientistDataset Switches between running on live data, or scientist data
  */
 public function __construct($settings = null, $scientistDataset = false)
 {
     $this->result = null;
     $this->imageId = null;
     try {
         $this->db = new ClassificationQuery();
     } catch (PDOException $exception) {
         trigger_error("Failure to create a database connection." . " Possibly database settings provided are wrong", E_USER_WARNING);
     }
     if (!$settings) {
         $settings = SettingsStorage::settings();
     }
     $this->scientistDataset = $scientistDataset;
     $this->CONSECUTIVE_EXPECTED = Utils::getValue($settings['consecutive_expected'], 8);
     $this->VOTES_BEFORE_CONSENSUS = Utils::getValue($settings['votes_before_consensus'], 15);
     $this->UNREASONABLE_NUMBER_OF_SPECIES_IN_IMAGE = Utils::getValue($settings['unreasonable_number_of_species_in_image'], 5);
     $this->EVENNESS_THRESHOLD_COUNT = Utils::getValue($settings['evenness_threshold_count'], 0.6899999999999999);
     $this->EVENNESS_THRESHOLD_SPECIES = Utils::getValue($settings['evenness_threshold_species'], 0.7);
     $this->NUMBER_OF_NOTHING_HERE_BEFORE_CLASSIFY = Utils::getValue($settings["number_of_nothing_here_before_classify"], 5);
 }
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:25,代码来源:MammalClassifier.php

示例8: JobStatusQuery

<?php

require "../core.php";
$onScientistData = Utils::getValue($_POST["scientist_dataset"], false);
$fromID = Utils::getValue($_POST["from_id"], 1);
$toID = Utils::getValue($_POST["to_id"], -1);
$settings = Utils::getValue($_POST["settings"], null);
if ($settings) {
    $settingsObj = json_decode($settings, true);
} else {
    $settingsObj = null;
}
$st = new JobStatusQuery();
$status = $st->fetch()->asArray();
$controller = new AlgorithmController();
/* if already running then abort */
if ($status["started"]) {
    return;
}
/* ignore user closing the connection */
ignore_user_abort(true);
/* allow infinite time */
set_time_limit(0);
$controller->runAlgorithmJobBatch($st, $settingsObj, $onScientistData, $fromID, $toID);
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:24,代码来源:run_algorithm_job.php

示例9: showAlert

    <button data-remodal-action="close" class="remodal-close"></button>
    <h1 id="register-title">注册</h1>
    <div class="pure-form">
        <input class="pure-input" id="reg-uname" type="text" placeholder="用户名">
        <input class="pure-input" id="reg-passwd" type="password" placeholder="密码">
        <input class="pure-input" id="reg-passwd2" type="password" placeholder="确认密码">
        <br />
        <button id="register-button" class="pure-button pure-button-primary">注册</button>
    </div>
    <div id="msg" class="alert"></div>
</div>

<script type="text/javascript" src="./libs/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="./libs/cookie.js"></script>
<script type="text/javascript" src="./libs/remodal/remodal.min.js"></script>
<script type="text/javascript" src="./libs/ply/ply.min.js"></script>
<script type="text/javascript" src="./assets/js/utils.js"></script>
<script type="text/javascript" src="./assets/js/index.utils.js"></script>
<?php 
if ($msg = Utils::getValue('msg', $_GET)) {
    ?>
<script type="text/javascript"> showAlert("<?php 
    echo $msg;
    ?>
"); </script>
<?php 
}
?>
</body>
</html>
开发者ID:weiwei1740,项目名称:blessing-skin-server,代码行数:30,代码来源:index.php

示例10: RecentQueries

<?php

require '../../core.php';
$csv = Utils::getValue($_GET['id']);
if ($csv) {
    $q = new RecentQueries();
    try {
        $json = $q->with(["id" => $csv])->fetch();
        if ($json instanceof QueryResults) {
            $json->asArray()[0]["json"];
        } else {
            throw new Exception();
        }
        $params = json_decode($json, true);
        if (isset($params["page"])) {
            unset($params["page"]);
        }
        if (isset($params["limit"])) {
            unset($params["limit"]);
        }
        $filterQuery = new FilterQuery();
        header("Content-Type: text/csv");
        header("Content-Disposition: attachment; filename=output.csv");
        header("Cache-Control: no-cache, no-store, must-revalidate");
        // HTTP 1.1
        header("Pragma: no-cache");
        // HTTP 1.0
        header("Expires: 0");
        // Proxies
        $queryResults = $filterQuery->with($params)->fetch()->asCSV();
    } catch (Exception $e) {
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:31,代码来源:csv.php

示例11:

$settings = (include_once 'config/settings.php');
$filename = '20151007110121.pdf';
$converted_file = '20151007110121.txt';
$filename = Utils::manageFileUpload();
if (!$filename) {
    $result = 'C\'&egrave; stato un problema durante l\'upload del file';
} else {
    if (strpos($filename, '.pdf') !== false) {
        if (Utils::getValue('template') == 'nestle') {
            $pdfToText = XPDF\PdfToText::create();
            // PDF text is now in the $text variable
            $sheetData = $pdfToText->getText(PROJ_ROOT . '/upload/' . $filename);
            echo $sheetData;
            die;
        } else {
            if (Utils::getValue('template') == 'monge') {
                $pdfToText = XPDF\PdfToText::create(array('-layout'));
                // PDF text is now in the $text variable
                $sheetData = $pdfToText->getText(PROJ_ROOT . '/upload/' . $filename);
                echo $sheetData;
                die;
            }
        }
        //
    }
}
/*
$pdfToText = XPDF\PdfToText::create(array(
    'pdftotext.binaries' => PROJ_ROOT.'/xpdf-3.04/xpdf/',
));*/
/*$options = '';
开发者ID:kawashita86,项目名称:xlsconversion,代码行数:31,代码来源:conversion.php

示例12: header

include '../../core.php';
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: X-Requested-With");
if (isset($_POST['params'])) {
    try {
        $params = json_decode($_POST['params'], true);
        if (is_null($params)) {
            error("Invalid JSON input");
            return;
        }
        $lastId = null;
        /* store as recent query */
        if (Utils::getValue($params["query"], false) === true) {
            $recentQueries = new RecentQueries();
            $lastId = $recentQueries->with(["json" => $_POST['params']])->store();
        }
        $filterQuery = new FilterQuery();
        $queryResults = $filterQuery->with($params)->fetch();
        echo json_encode(["id" => $lastId, "results" => $queryResults->asArray()], JSON_PRETTY_PRINT);
    } catch (PDOException $e) {
        error("Failure in database connection.");
    }
} else {
    if (isset($_GET['csv'])) {
        $csvPath = SettingsStorage::settings()["csv_file_locations"];
        $filename = Utils::sanitizeFilename($_GET['csv']);
        FileStorage::downloadFile($filename, $csvPath);
    } else {
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:30,代码来源:filter.php

示例13: rtrim

                $fields_string .= $key . '=' . $value . '&';
            }
            rtrim($fields_string, '&');
            //open connection
            $ch = curl_init();
            //set the url, number of POST vars, POST data
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_TIMEOUT, 1);
            curl_setopt($ch, CURLOPT_POST, count($fields));
            curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
            //execute post
            $result = curl_exec($ch);
            //close connection
            curl_close($ch);
            echo json_encode(["success" => true, "log" => "Algorithm started."]);
        } else {
            if ($action === "empty") {
                $scientistDataset = Utils::getValue($_POST["scientist_dataset"], false);
                $controller->clearResults($scientistDataset);
                return json_encode(["success" => true]);
            }
        }
    } else {
        error("No action specified.");
    }
}
function error($status)
{
    echo json_encode(["error" => $status]);
}
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:31,代码来源:algorithm.php

示例14: file_get_contents

                if (strpos($filename, '.txt') !== false || strpos($filename, '.TXT') !== false) {
                    $sheetData = file_get_contents('upload/' . $filename);
                }
            }
        }
        if (Utils::getValue('template') && !empty(Utils::getValue('template'))) {
            $className = ucfirst(Utils::getValue('template')) . 'Xml';
            if (class_exists($className)) {
                if (Utils::getValue('template') == 'amazon') {
                    $sheetData = 'upload/' . $filename;
                }
                $templateXML = new $className($settings['company_information'], $settings[Utils::getValue('template')]['company_information'], $sheetData);
                $templateXML->createDocument();
                //setupdownload header
                header("Content-Type: text/html/force-download");
                header("Content-Disposition: attachment; filename=" . Utils::getValue('template') . $templateXML->rif_fattura . ".xml");
                header('Cache-Control: max-age=0');
                echo $templateXML->outputXml();
                //everything fine, delete old file
                @unlink('upload/' . $filename);
                $result = true;
            } else {
                $result = 'C\'&egrave; stato un problema durante la creazione del documento in formato DaneaXml';
            }
        } else {
            $result = 'C\'&egrave; stato un problema durante il recupero del template richiesto';
        }
    }
}
if ($result !== true) {
    ?>
开发者ID:kawashita86,项目名称:xlsconversion,代码行数:31,代码来源:index.php

示例15: fetchQuery

 protected function fetchQuery(&$params)
 {
     $usersToInclude = Utils::getValue($params["users_include"], []);
     $usersToExclude = Utils::getValue($params["users_exclude"], []);
     $speciesToInclude = Utils::getValue($params["species_include"], []);
     $speciesToExclude = Utils::getValue($params["species_exclude"], []);
     $hasSpeciesToInclude = count($speciesToInclude) > 0;
     $hasSpeciesToExclude = count($speciesToExclude) > 0;
     $hasUsersToInclude = count($usersToInclude) > 0;
     $hasUsersToExclude = count($usersToExclude) > 0;
     // date has to be YYYY-MM-DD HH:MM:SS
     $hasTimeStamps = Utils::keysExist(["taken_start", "taken_end"], $params);
     $hasFlagged = Utils::keysExist("flagged", $params);
     $hasSiteId = Utils::keysExist("site_id", $params);
     $hasHumans = Utils::keysExist("contains_human", $params);
     $hasNumberOfClassifications = Utils::keysExist("no_of_classifications", $params);
     $hasNumberOfSpecies = Utils::keysExist("no_of_species", $params);
     $hasHabitatType = Utils::keysExist("habitat_id", $params);
     $hasPhotoId = Utils::keysExist("photo_id", $params);
     $hasNumberOfClassificationsFrom = Utils::keysExist("no_of_classifications_from", $params);
     $hasNumberOfClassificationsTo = Utils::keysExist("no_of_classifications_to", $params);
     /* depending on whether we are filtering temporary scientist results
        or results in the public table we switch the table name accordingly */
     $classifiedTableName = Utils::getValue($params["scientist_dataset"], false) ? self::CLASSIFIED_SCIENTIST_TABLE_NAME : self::CLASSIFIED_TABLE_NAME;
     $evennessTableName = Utils::getValue($params["scientist_dataset"], false) ? self::EVENNESS_SCIENTIST_TABLE_NAME : self::EVENNESS_TABLE_NAME;
     // SELECT * FROM classified
     // WHERE species IN (?,?,?,...) AND NOT IN (?,?,...)
     $query = $this->db->from("{$classifiedTableName} AS classified_tbl")->select(['classified_tbl.photo_id', 'classified_tbl.species', 'classified_tbl.flagged', 'classified_tbl.timestamp AS time_classified'])->leftJoin('photo ON photo.photo_id = classified_tbl.photo_id')->select(['photo.taken', 'photo.person_id', 'photo.site_id', 'photo.filename', 'photo.contains_human'])->leftJoin('site ON site.site_id = photo.site_id')->select(['site.habitat_id', 'site.site_name'])->leftJoin('options ON options.option_id = classified_tbl.species')->select('options.option_name AS species_name')->leftJoin("{$evennessTableName} AS evenness_tbl ON evenness_tbl.photo_id = classified_tbl.photo_id")->select(['evenness_tbl.evenness_species', 'evenness_tbl.evenness_count'])->leftJoin('options AS options2 ON options2.option_id = site.habitat_id')->select('options2.option_name AS habitat_name');
     if ($hasNumberOfClassificationsFrom && $hasNumberOfClassificationsTo) {
         $classificationsFrom = $params["no_of_classifications_from"];
         $classificationsTo = $params["no_of_classifications_to"];
         $query->leftJoin('animal ON animal.photo_id = classified_tbl.photo_id')->select('COUNT(DISTINCT animal.person_id) AS no_of_classifications')->groupBy('classified_tbl.photo_id')->having("COUNT(DISTINCT animal.person_id) BETWEEN ? AND ?", $classificationsFrom, $classificationsTo);
     } else {
         if ($hasNumberOfClassifications) {
             $numberOfClassifications = $params["no_of_classifications"];
             $query->leftJoin('animal ON animal.photo_id = classified_tbl.photo_id')->select('COUNT(DISTINCT animal.person_id) AS no_of_classifications')->groupBy('classified_tbl.photo_id')->having("COUNT(DISTINCT animal.person_id) = ?", $numberOfClassifications);
         }
     }
     if ($hasNumberOfSpecies) {
         $numberOfSpecies = $params["no_of_species"];
         $query->innerJoin("(SELECT ct.photo_id,COUNT(*) as counted from {$classifiedTableName} AS ct GROUP by photo_id) c ON c.photo_id = classified_tbl.photo_id");
         $query->where("c.counted = ?", $numberOfSpecies);
     }
     if ($hasPhotoId) {
         $photoId = $params["photo_id"];
         $query->where('classified_tbl.photo_id', $photoId);
     }
     if ($hasHabitatType) {
         $habitatType = $params["habitat_id"];
         $query->where('site.habitat_id', $habitatType);
     }
     //$this->db->debug = true;
     if ($hasSpeciesToInclude) {
         $query->where("classified_tbl.species", $speciesToInclude);
     }
     if ($hasSpeciesToExclude) {
         $unknowns = Utils::generateUnknowns($speciesToExclude);
         $query->where("classified_tbl.species NOT IN ({$unknowns})", ["expand" => $speciesToExclude]);
     }
     if ($hasUsersToInclude) {
         $query->where("photo.person_id", $usersToInclude);
     }
     if ($hasUsersToExclude) {
         $unknowns = Utils::generateUnknowns($usersToExclude);
         $query->where("photo.person_id NOT IN ({$unknowns})", ['expand' => $usersToExclude]);
     }
     if ($hasTimeStamps) {
         $takenStart = $params['taken_start'];
         $takenEnd = $params['taken_end'];
         $query->where("photo.taken BETWEEN ? AND ?", $takenStart, $takenEnd);
     }
     if ($hasFlagged) {
         $flagged = $params['flagged'];
         $query->where("classified_tbl.flagged", $flagged);
     }
     if ($hasSiteId) {
         $siteId = $params['site_id'];
         $query->where("photo.site_id", $siteId);
     }
     if ($hasHumans) {
         $humans = $params['contains_human'];
         $query->where("photo.contains_human", $humans);
     }
     /* expand is a special keyword which says take the arguments from the list and bind them to unbound variables
           eg. Query is WHERE NOT IN (?,?)
                $args = [15,22]
                passing in ['expand' => $args]
                replaces the ?,? with 15,22 as in WHERE NOT IN (15,22)
        */
     $this->addFetchQuery($query);
 }
开发者ID:xdrop,项目名称:MammalWebCS,代码行数:91,代码来源:FilterQuery.php


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