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


PHP o函数代码示例

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


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

示例1: getEventsByTarget

 static function getEventsByTarget($deviceDS)
 {
     $where = array('e_code LIKE ?', 'e_code LIKE ?', 'e_code LIKE ?');
     $searchPatterns = array('%' . $deviceDS['d_id'] . '%', '%' . @first($deviceDS['d_alias'], 'NOMATCH') . '%');
     return o(db)->get('SELECT * FROM #events WHERE
     ' . implode(' OR ', $where), $searchPatterns);
 }
开发者ID:bangnaga,项目名称:HomeOverlord,代码行数:7,代码来源:H2EventManager.php

示例2: render

 public function render()
 {
     if (!$this->value_is_valid) {
         $this->attribute("ERROR");
     }
     $output = "<div class='form-element-wrapper'>";
     if ($this->label && $this->attributes['id']) {
         $output .= "<span id='" . o($this->attributes['id']) . "'>" . o($this->label) . ": </span>";
     }
     $output .= "<span " . $this->getAttributeString() . ">";
     foreach ($this->options as $value => $option) {
         $option = o($option);
         $value = o($value);
         $output .= "<span class='form-element-radio-option'>";
         if ($option) {
             $output .= "<label for='" . o($this->attributes['id']) . "-{$value}'>{$option}: </label>";
         }
         if ($value == $this->selected_option) {
             $output .= "<input type='radio' name='" . o($this->name) . "' id='" . o($this->attributes['id']) . "-{$value}' value='{$value}' checked='checked' />";
         } else {
             $output .= "<input type='radio' name='" . o($this->name) . "' id='" . o($this->attributes['id']) . "-{$value}' value='{$value}' />";
         }
         $output .= "</span>";
     }
     $output .= "</span>";
     $output .= "</div>";
     return $output;
 }
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:28,代码来源:Radio.class.php

示例3: showBody

function showBody()
{
    #----------------------------------------------------------------------
    global $chosenPersonId;
    // simple validation first...
    if (!preg_match('/\\d{4}\\w{4}\\d{2}/', $chosenPersonId)) {
        showErrorMessage('Invalid WCA id Format <strong>[</strong>' . o($chosenPersonId) . '<strong>]</strong>');
        print '<p><a href="persons.php">Click here to search for people.</a></p>';
        return;
    }
    #--- Get all incarnations of the person.
    $persons = dbQuery("\n    SELECT person.name personName, country.name countryName, day, month, year, gender\n    FROM Persons person, Countries country\n    WHERE person.id = '{$chosenPersonId}' AND country.id = person.countryId\n    ORDER BY person.subId\n  ");
    #--- If there are none, show an error and do no more.
    if (!count($persons)) {
        showErrorMessage('Unknown person id <strong>[</strong>' . o($chosenPersonId) . '<strong>]</strong>');
        $namepart = substr($chosenPersonId, 4, 4);
        print '<p><a href="persons.php?pattern=' . urlEncode($namepart) . '">Click to search for people with `' . o($namepart) . '` in their name.</a></p>';
        return;
    }
    #--- Get and show the current incarnation.
    $currentPerson = array_shift($persons);
    extract($currentPerson);
    echo "<h1>{$personName}</h1>";
    #--- Show previous incarnations if any.
    if (count($persons)) {
        echo "<p class='subtitle'>(previously ";
        foreach ($persons as $person) {
            $previous[] = "{$person['personName']}/{$person['countryName']}";
        }
        echo implode(', ', $previous) . ")</p>";
    }
    #--- Show the picture if any.
    $picture = getCurrentPictureFile($chosenPersonId);
    if ($picture) {
        echo "<center><img class='person' src='{$picture}' /></center>";
    }
    #--- Show the In Memoriam if any.
    $inMemoriamArray = array("2008COUR01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=2028", "2003LARS01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=1982", "2012GALA02" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=1044", "2008LIMR01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=945", "2008KIRC01" => "https://www.worldcubeassociation.org/forum/viewtopic.php?t=470");
    if (array_key_exists($chosenPersonId, $inMemoriamArray)) {
        echo "<center><a target='_blank' href='{$inMemoriamArray[$chosenPersonId]}'>In Memoriam</a></center>";
    }
    #--- Show the details.
    tableBegin('results', 4);
    tableCaption(false, 'Details');
    tableHeader(explode('|', 'Country|WCA Id|Gender|Competitions'), array(3 => 'class="f"'));
    $gender_text = genderText($gender);
    $numberOfCompetitions = dbValue("SELECT count(distinct competitionId) FROM Results where personId='{$chosenPersonId}'");
    tableRow(array($countryName, $chosenPersonId, $gender_text, $numberOfCompetitions));
    tableEnd();
    #--- Try the cache for the results
    # tryCache( 'person', $chosenPersonId );
    #--- Now the results.
    require 'includes/person_personal_records_current.php';
    require 'includes/person_world_championship_podiums.php';
    require 'includes/person_world_records_history.php';
    require 'includes/person_continent_records_history.php';
    require 'includes/person_events.php';
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:58,代码来源:person.php

示例4: ajax_getstate

 function ajax_getstate()
 {
     $r = array();
     foreach (o(db)->get('SELECT * FROM devices
   ORDER BY d_room, d_key') as $d) {
         $r['d' . $d['d_id']] = array('id' => $d['d_id'], 'state' => $d['d_state'], 'd_name' => $d['d_name']);
     }
     print json_encode($r);
 }
开发者ID:bangnaga,项目名称:HomeOverlord,代码行数:9,代码来源:svc.controller.php

示例5: getData

 function getData()
 {
     $this->fields = o(db)->fields($this->props['table']);
     $this->prepareFieldProperties();
     if (sizeof($this->props['cols']) == 0) {
         $this->makeAutoColumns();
     }
     $this->data = o(db)->get('SELECT * FROM ?', array('$' . $this->props['table']));
     return $this;
 }
开发者ID:bangnaga,项目名称:HomeOverlord,代码行数:10,代码来源:H2Table.php

示例6: render

 public function render()
 {
     $output = parent::render();
     $output .= "<div class='form-element-wrapper'>";
     if ($this->label && $this->attributes['id']) {
         $output .= "<label for='" . o($this->attributes['id']) . "'>" . o($this->label) . ": </label>";
     }
     $output .= "<input" . $this->getAttributeString() . "/>";
     $output .= "</div>";
     return $output;
 }
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:11,代码来源:Input.class.php

示例7: getGroupsByDevice

 static function getGroupsByDevice($deviceDS)
 {
     $matchingGroups = array();
     foreach (o(db)->get('SELECT * FROM #nvstore WHERE nv_key LIKE "group/%" ORDER BY nv_key') as $grpData) {
         $gName = $grpData['nv_key'];
         CutSegment('/', $gName);
         $gList = json_decode($grpData['nv_data']);
         if (is_array($gList) && array_search($deviceDS['d_key'], $gList) !== false) {
             $matchingGroups[] = $gName;
         }
     }
     return $matchingGroups;
 }
开发者ID:bangnaga,项目名称:HomeOverlord,代码行数:13,代码来源:H2GroupManager.php

示例8: newRow

 public function newRow($data = array())
 {
     $object = o(sha1(time() . $this->settings['entity'] . session_id() . Utils::token()));
     $object->thin_litedb = $this;
     $object->id = null;
     if (count($data) && Arrays::isAssoc($data)) {
         foreach ($this->settings['modelFields'] as $field => $infos) {
             $value = ake($field, $data) ? $data[$field] : null;
             $object->{$field} = $value;
         }
     }
     return $object;
 }
开发者ID:schpill,项目名称:thin,代码行数:13,代码来源:Litedb.php

示例9: signin

    function signin()
    {
        if ($_POST['fid'] == sha1($_SESSION['fid'])) {
            $uds = o(db)->getDSMatch('accounts', array('a_username' => trim($_POST['username']), 'a_password' => sha1($_POST['password'])));
            if ($uds['a_key'] > 0) {
                WriteToFile('log/account.log', date('Y-m-d H:i:s') . ' (i) ' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ' : ' . $_SERVER['REMOTE_ADDR'] . ' sign in with ' . trim($_POST['username']) . '/***' . chr(10));
                $_SESSION['uid'] = $uds['a_key'];
                $_SESSION['ds'] = $uds;
                header('location: ./?');
                die;
            } else {
                WriteToFile('log/account.log', date('Y-m-d H:i:s') . ' (f) ' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ' : ' . $_SERVER['REMOTE_ADDR'] . ' sign in failed with ' . trim($_POST['username']) . '/***' . chr(10));
                ?>
<div style="text-align: center">Error signing in, try again.</div><?php 
            }
        } else {
            WriteToFile('log/account.log', date('Y-m-d H:i:s') . ' (a) ' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ' : ' . gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']) . ' signin page ' . chr(10));
        }
    }
开发者ID:bangnaga,项目名称:HomeOverlord,代码行数:19,代码来源:accounts.controller.php

示例10: initController

 function initController($controllerName)
 {
     $controllerName = first($controllerName, cfg('service/defaultcontroller'));
     $this->controllerName = safeName($controllerName);
     $this->controllerFile = 'mvc/' . strtolower($this->controllerName) . '/' . strtolower($this->controllerName) . '.controller.php';
     if (!file_exists($this->controllerFile)) {
         header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
         header('Status: 404 Not Found');
         die('File not found at: ' . $_SERVER['REQUEST_URI'] . '<br/>Controller: ' . $this->controllerName);
     }
     require_once $this->controllerFile;
     $this->controllerClassName = $this->controllerName . 'Controller';
     $this->controller = o(new $this->controllerClassName($this->controllerName), 'controller');
     if (is_callable(array($this->controller, '__init'))) {
         $this->controller->__init();
     }
     $_REQUEST['controller'] = $this->controllerName;
     profile_point('H2Dispatcher.initController(' . $this->controllerName . ')');
     return $this;
 }
开发者ID:bangnaga,项目名称:HomeOverlord,代码行数:20,代码来源:H2Dispatcher.php

示例11: render

 public function render()
 {
     $output = parent::render();
     $output .= "<div class='form-element-wrapper'>";
     if ($this->label && $this->attributes['id']) {
         $output .= "<label for='" . o($this->attributes['id']) . "'>" . o($this->label) . ": </label>";
     }
     $output .= "<select" . $this->getAttributeString() . ">";
     foreach ($this->options as $value => $option) {
         $option = o($option);
         $value = o($value);
         if ($value == $this->selected_option) {
             $output .= "<option selected value='{$value}'>{$option}</option>";
         } else {
             $output .= "<option value='{$value}'>{$option}</option>";
         }
     }
     $output .= "</select>";
     $output .= "</div>";
     return $output;
 }
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:21,代码来源:Select.class.php

示例12: group_delete

 function group_delete()
 {
     o(db)->remove('groups', $_REQUEST['id']);
     $this->viewName = 'groups';
 }
开发者ID:bangnaga,项目名称:HomeOverlord,代码行数:5,代码来源:devices.controller.php

示例13: listCompetitions

function listCompetitions () {
#----------------------------------------------------------------------
  global $chosenEventId, $chosenYears, $chosenRegionId, $chosenPatternHtml;
  global $chosenList, $chosenMap;
  global $chosenCompetitions;

  $chosenCompetitions = getCompetitions( $chosenList );

  tableBegin( 'results', 5 );
  tableCaption( false, spaced(array( eventName($chosenEventId), chosenRegionName(), $chosenYears, $chosenPatternHtml ? "\"$chosenPatternHtml\"" : '' )));

  if( $chosenList ){ 

    tableHeader( explode( '|', 'Year|Date|Name|Country, City|Venue' ),
                 array( 4 => 'class="f"' ));

    foreach( $chosenCompetitions as $competition ){
      extract( $competition );

      if( isset( $previousYear )  &&  $year != $previousYear )
        tableRowEmpty();
      $previousYear = $year;

      $isPast = wcaDate( 'Ymd' ) > (10000*$year + 100*$month + $day);

      tableRow( array(
        $year,
        competitionDate( $competition ),
        $isPast ? competitionLink( $id, $cellName ) : (( $showPreregForm || $showPreregList ) ? competitionLinkClassed( 'rg', $id, $cellName ) : competitionLinkClassed( 'fc', $id, $cellName )),
        "<b>$countryName</b>, $cityName",
        processLinks( $venue )
      ));
    }
  }

  tableEnd();


  if( $chosenMap ) {
    // create map markers
    $markers = array();
    foreach($chosenCompetitions as $comp) {
      $markers[$comp['id']] = array();
      $markers[$comp['id']]['latitude'] = $comp['latitude'];
      $markers[$comp['id']]['longitude'] = $comp['longitude'];
      $markers[$comp['id']]['info'] = "<a href='c.php?i=".$comp['id']."'>" . o($comp['cellName']) . "</a><br />"
        . date("M j, Y", mktime(0,0,0,$comp['month'],$comp['day'],$comp['year']))
        . " - " . o($comp['cityName']);
    }
    displayMap($markers);
  }
}
开发者ID:neodude,项目名称:worldcubeassociation.org,代码行数:52,代码来源:competitions.php

示例14: log_error

/**
 * Logs an error message to the error log. A newline character is appended to the message.
 * The given message is also echoed to the console.
 *
 * @param $message string the message to log.
 */
function log_error(string $message)
{
    global $board;
    o($message);
    file_put_contents($board . '.error', date("c: ") . $message . PHP_EOL, FILE_APPEND);
}
开发者ID:bstats,项目名称:b-stats,代码行数:12,代码来源:archiver.php

示例15: container

 function container()
 {
     return o('thinContainer');
 }
开发者ID:noikiy,项目名称:inovi,代码行数:4,代码来源:Helper.php


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