本文整理汇总了PHP中Extension::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Extension::find方法的具体用法?PHP Extension::find怎么用?PHP Extension::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Extension
的用法示例。
在下文中一共展示了Extension::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_load_extensions
public function api_load_extensions()
{
$times = Time::all();
$counter = 0;
foreach ($times as $time) {
$extension_test_project = Extension::find(array('conditions' => array('value = ?', $time->project_name)));
$extension_test_service = Extension::find(array('conditions' => array('value = ?', $time->service_name)));
if ($extension_test_project == null && $time->project_name != null) {
$create = Extension::create(array('parent' => NULL, 'value' => $time->project_name));
$counter++;
}
if ($extension_test_service == null && $time->service_name != null) {
if ($extension_test_project == null && $time->project_name != null) {
$extension_test_project = Extension::find(array('conditions' => array('value = ?', $time->project_name)));
}
$create = Extension::create(array('parent' => $extension_test_project->id, 'value' => $time->service_name));
$counter++;
}
}
echo $counter;
}
示例2: search
public function search()
{
if (empty($_GET['query'])) {
exit;
}
# TODO
$config = Config::current();
if ($config->clean_urls and substr_count($_SERVER['REQUEST_URI'], "?") and !substr_count($_SERVER['REQUEST_URI'], "%2F")) {
# Searches with / and clean URLs = server 404
redirect("search/" . urlencode($_GET['query']) . "/");
}
if (empty($_GET['query'])) {
return Flash::warning(__("Please enter a search term."));
}
list($where, $params) = keywords($_GET['query'], "name LIKE :query OR url LIKE :query", "extensions");
$extensions = Extension::find(array("placeholders" => true, "where" => $where, "params" => $params));
list($where, $params) = keywords($_GET['query'], "description LIKE :query OR tags LIKE :query", "versions");
$versions = Version::find(array("placeholders" => true, "where" => $where, "params" => $params));
list($where, $params) = keywords($_GET['query'], "body LIKE :query", "notes");
$notes = Note::find(array("placeholders" => true, "where" => $where, "params" => $params));
$this->display("extend/search", array("extensions" => new Paginator($extensions, 25, "extensions_page"), "versions" => new Paginator($versions, 25, "versions_page"), "notes" => new Paginator($notes, 25, "notes_page"), "search" => $_GET['query']), fix(_f("Search results for \"%s\"", $_GET['query'])));
}