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


PHP fHTML::encode方法代码示例

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


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

示例1: getRow

 public function getRow($row)
 {
     $r = array();
     $r[0] = $row;
     // rank
     $id = $text = $this->owners[$row - 1]['id'];
     if (strlen($name = $this->owners[$row - 1]['name'])) {
         $text .= ' ' . $name;
     }
     $id = fHTML::encode($id);
     $text = fHTML::encode($text);
     if (empty($id)) {
         $r[1] = $text;
     } else {
         $r[1] = '<a href="' . SITE_BASE . "/status?owner={$id}\">{$text}</a>";
     }
     $n = count($this->headers);
     for ($i = 2; $i < $n; $i++) {
         if ($this->scores[$row - 1][$i - 2] == '-') {
             $r[$i] = $this->scores[$row - 1][$i - 2];
         } else {
             if ($i < $n - 3) {
                 $r[$i] = '<a href="' . SITE_BASE . "/status?owner={$id}&problem={$this->headers[$i]}\">{$this->scores[$row - 1][$i - 2]}</a>";
             } else {
                 if ($i < $n - 2) {
                     $r[$i] = '<a href="' . SITE_BASE . "/status?owner={$id}&verdict=1\">{$this->scores[$row - 1][$i - 2]}</a>";
                 } else {
                     $r[$i] = $this->scores[$row - 1][$i - 2];
                 }
             }
         }
     }
     return $r;
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:34,代码来源:BoardTable.php

示例2: index

 public function index()
 {
     $this->cache_control('private', 5);
     if ($pid = fRequest::get('id', 'integer')) {
         Util::redirect('/problem/' . $pid);
     }
     $view_any = User::can('view-any-problem');
     $this->page = fRequest::get('page', 'integer', 1);
     $this->title = trim(fRequest::get('title', 'string'));
     $this->author = trim(fRequest::get('author', 'string'));
     $this->problems = Problem::find($view_any, $this->page, $this->title, $this->author);
     $this->page_url = SITE_BASE . '/problems?';
     if (!empty($this->title)) {
         $this->page_url .= 'title=' . fHTML::encode($this->title) . '&';
     }
     if (!empty($this->author)) {
         $this->page_url .= 'author=' . fHTML::encode($this->author) . '&';
     }
     $this->page_url .= 'page=';
     $this->page_records = $this->problems;
     $this->nav_class = 'problems';
     $this->render('problem/index');
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:23,代码来源:ProblemController.php

示例3: encode

 /**
  * Gets the value of an element and runs it through fHTML::encode()
  *
  * @param  string $element        The element to get - array elements can be accessed via `[sub-key]` syntax, and thus `[` and `]` can not be used in element names
  * @param  mixed  $default_value  The value to return if the element has not been set
  * @return mixed  The value of the element specified run through fHTML::encode(), or the default value if it has not been set
  */
 public function encode($element, $default_value = NULL)
 {
     return fHTML::encode($this->get($element, $default_value));
 }
开发者ID:r15ch13,项目名称:flourish-classes,代码行数:11,代码来源:fTemplating.php

示例4:

<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title><?php 
echo fHTML::encode($title . TITLE_SUFFIX);
?>
</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <?php 
if (isset($meta_description)) {
    ?>
    <meta name="description" content="<?php 
    echo $meta_description;
    ?>
">
  <?php 
}
?>
  <?php 
if (isset($meta_author)) {
    ?>
    <meta name="author" content="<?php 
    echo $meta_author;
    ?>
">
  <?php 
}
?>
  <link href="<?php 
echo ASSET_CSS;
开发者ID:daerduoCarey,项目名称:oj,代码行数:31,代码来源:header.php

示例5: Markdown

<?php

$title = $this->page_title;
include __DIR__ . '/../layout/header.php';
?>
<div class="page-header">
  <h1><?php 
echo fHTML::encode($title);
?>
</h1>
</div>
<article><?php 
echo Markdown($this->page_content);
?>
</article>
<?php 
include __DIR__ . '/../layout/footer.php';
开发者ID:daerduoCarey,项目名称:oj,代码行数:17,代码来源:show_page.php

示例6: encode

 /**
  * Retrieves a value from the record and prepares it for output into an HTML form element.
  * 
  * Below are the transformations performed:
  *  
  *  - **varchar, char, text**: will run through fHTML::encode(), if `TRUE` is passed the text will be run through fHTML::convertNewLinks() and fHTML::makeLinks()
  *  - **float**: takes 1 parameter to specify the number of decimal places
  *  - **date, time, timestamp**: `format()` will be called on the fDate/fTime/fTimestamp object with the 1 parameter specified
  *  - **objects**: the object will be converted to a string by `__toString()` or a `(string)` cast and then will be run through fHTML::encode()
  *  - **all other data types**: the value will be run through fHTML::encode()
  * 
  * @param  string $column      The name of the column to retrieve
  * @param  string $formatting  The formatting string
  * @return string  The encoded value for the column specified
  */
 protected function encode($column, $formatting = NULL)
 {
     $column_exists = array_key_exists($column, $this->values);
     $method_name = 'get' . fGrammar::camelize($column, TRUE);
     $method_exists = method_exists($this, $method_name);
     if (!$column_exists && !$method_exists) {
         throw new fProgrammerException('The column specified, %s, does not exist', $column);
     }
     if ($column_exists) {
         $class = get_class($this);
         $schema = fORMSchema::retrieve($class);
         $table = fORM::tablize($class);
         $column_type = $schema->getColumnInfo($table, $column, 'type');
         // Ensure the programmer is calling the function properly
         if ($column_type == 'blob') {
             throw new fProgrammerException('The column specified, %s, does not support forming because it is a blob column', $column);
         }
         if ($formatting !== NULL && in_array($column_type, array('boolean', 'integer'))) {
             throw new fProgrammerException('The column specified, %s, does not support any formatting options', $column);
         }
         // If the column doesn't exist, we are just pulling the
         // value from a get method, so treat it as text
     } else {
         $column_type = 'text';
     }
     // Grab the value for empty value checking
     $value = $this->{$method_name}();
     // Date/time objects
     if (is_object($value) && in_array($column_type, array('date', 'time', 'timestamp'))) {
         if ($formatting === NULL) {
             throw new fProgrammerException('The column specified, %s, requires one formatting parameter, a valid date() formatting string', $column);
         }
         $value = $value->format($formatting);
     }
     // Other objects
     if (is_object($value) && is_callable(array($value, '__toString'))) {
         $value = $value->__toString();
     } elseif (is_object($value)) {
         $value = (string) $value;
     }
     // Make sure we don't mangle a non-float value
     if ($column_type == 'float' && is_numeric($value)) {
         $column_decimal_places = $schema->getColumnInfo($table, $column, 'decimal_places');
         // If the user passed in a formatting value, use it
         if ($formatting !== NULL && is_numeric($formatting)) {
             $decimal_places = (int) $formatting;
             // If the column has a pre-defined number of decimal places, use that
         } elseif ($column_decimal_places !== NULL) {
             $decimal_places = $column_decimal_places;
             // This figures out how many decimal places are part of the current value
         } else {
             $value_parts = explode('.', $value);
             $decimal_places = !isset($value_parts[1]) ? 0 : strlen($value_parts[1]);
         }
         return number_format($value, $decimal_places, '.', '');
     }
     // Turn line-breaks into breaks for text fields and add links
     if ($formatting === TRUE && in_array($column_type, array('varchar', 'char', 'text'))) {
         return fHTML::makeLinks(fHTML::convertNewlines(fHTML::encode($value)));
     }
     // Anything that has gotten to here is a string value or is not the proper data type for the column that contains it
     return fHTML::encode($value);
 }
开发者ID:mrjwc,项目名称:printmaster,代码行数:78,代码来源:fActiveRecord.php

示例7: encode

 /**
  * Gets a value from ::get() and passes it through fHTML::encode()
  * 
  * @param  string $key            The key to get the value of
  * @param  string $cast_to        Cast the value to this data type
  * @param  mixed  $default_value  If the parameter is not set in the `DELETE`/`PUT` post data, `$_POST` or `$_GET`, use this value instead
  * @return string  The encoded value
  */
 public static function encode($key, $cast_to = NULL, $default_value = NULL)
 {
     return fHTML::encode(self::get($key, $cast_to, $default_value));
 }
开发者ID:hibble,项目名称:printmaster,代码行数:12,代码来源:fRequest.php

示例8: printOption

 /**
  * Prints an `option` tag with the provided value, using the selected value to determine if the option should be marked as selected
  * 
  * @param  string $text            The text to display in the option tag
  * @param  string $value           The value for the option
  * @param  string $selected_value  If the value is the same as this, the option will be marked as selected
  * @return void
  */
 public static function printOption($text, $value, $selected_value = NULL)
 {
     $selected = FALSE;
     if ($value == $selected_value || is_array($selected_value) && in_array($value, $selected_value)) {
         $selected = TRUE;
     }
     echo '<option value="' . fHTML::encode($value) . '"';
     if ($selected) {
         echo ' selected="selected"';
     }
     echo '>' . fHTML::prepare($text) . '</option>';
 }
开发者ID:philip,项目名称:flourish,代码行数:20,代码来源:fHTML.php

示例9:

"><?php 
        echo fHTML::prepare($v->getName());
        ?>
</h3>
      <a href="#variables">[list]</a>
      <?php 
        if (User::can('set-variable')) {
            ?>
        <a href="?edit=<?php 
            echo fHTML::encode($v->getName());
            ?>
#set_variable">[edit]</a>
        <a href="?remove=<?php 
            echo fHTML::encode($v->getName());
            ?>
#set_variable">[remove]</a>
      <?php 
        }
        ?>
      <pre><?php 
        echo fHTML::encode($v->getValue());
        ?>
</pre>
    <?php 
    }
    ?>
  </fieldset>
</form>
<?php 
}
include __DIR__ . '/../layout/footer.php';
开发者ID:daerduoCarey,项目名称:oj,代码行数:31,代码来源:index.php

示例10: elseif

    }
    include VIEW_PATH . '/delete.php';
    // --------------------------------- //
} elseif ('edit' == $action) {
    try {
        $setting = new Setting(array('name' => $setting_name, 'owner_id' => $owner_id));
        if (fRequest::isPost()) {
            $setting->populate();
            fRequest::validateCSRFToken(fRequest::get('token'));
            $setting->store();
            fMessaging::create('affected', fURL::get(), $setting->getFriendlyName());
            fMessaging::create('success', fURL::get(), 'The setting ' . $setting->getFriendlyName() . ' was successfully updated');
            fURL::redirect(Setting::makeURL('list', $setting_type, NULL, $owner_id));
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', fURL::get(), 'The Setting requested, ' . fHTML::encode($setting_name) . ', could not be found');
        fURL::redirect(Setting::makeUrl('list'));
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/add_edit_setting.php';
    // --------------------------------- //
} elseif ('add' == $action) {
    $setting = new Setting();
    if ('user' == $setting_type) {
        $list_plugin_settings = $plugin_user_settings;
    } else {
        $list_plugin_settings = $plugin_settings;
    }
    if (!array_key_exists($setting_name, $list_plugin_settings)) {
        $setting_name = '';
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:setting.php

示例11: header

<?php

include '../inc/init.php';
include '../inc/flourishDB.php';
header('Content-type: application/json; charset=utf-8');
$readings = fRecordSet::build('Reading', array('is_verified=' => 1, 'reading_date>' => array(new fDate('-2 days'))), NULL, 100, 0);
echo '{"results":[';
$datastreams = "";
$jsonData = "";
foreach ($readings as $reading) {
    $user = $reading->createUser();
    $unit = $reading->createUnit();
    $datastreams .= '{"title": "' . $user->getFirstName() . ' ' . $user->getLastName() . '",' . '"title_jp": "",' . '"description": "Equipment used: ' . rtrim(fHTML::encode($reading->getEquipment())) . '",' . '"source": "rdtn.org",' . '"creator": "rdtn.org",' . '"feed": "http://www.rdtn.org/feeds/readings/' . $reading->getReadingId() . '.json",' . '"location": {"lon":' . $reading->getLng() . ', "lat":' . $reading->getLat() . ', "name": ""},' . '"id":' . $reading->getReadingId() . ',' . '"datastreams": [';
    $success = false;
    //foreach($stationdatas as $stationdata){
    //$sa = $stationdata->getSa();
    //if($sa!=-888 && $sa!=-999){
    $datastreams .= '{"at": "' . $reading->getReadingDate() . '",' . '"max_value": "' . $reading->getReadingValue() . '",' . '"min_value": "' . $reading->getReadingValue() . '",' . '"current_value": "' . $reading->getReadingValue() . '",' . '"id": "' . $reading->getReadingId() . '",' . '"unit": {"type": "' . $unit->getUnitType() . '","label": "' . $unit->getUnitLabel() . '","symbol": "' . $unit->getUnitSymbol() . '"}}';
    $success = true;
    //	break;
    //}
    //}
    if ($success) {
        //close and append
        $datastreams .= ']},';
        $jsonData .= $datastreams;
    }
    $datastreams = "";
}
echo rtrim($jsonData, ',');
echo '], "itemsPerPage": ' . $readings->count() . ', "startIndex": 0, "totalResults": ' . $readings->count(TRUE) . '}';
开发者ID:hicapacity,项目名称:safecast.org,代码行数:31,代码来源:rdtn.php

示例12: elseif

    // --------------------------------- //
} elseif ('edit' == $action) {
    if ($group_id == $GLOBALS['DEFAULT_GROUP_ID']) {
        fURL::redirect(Group::makeUrl('list'));
    } else {
        try {
            $group = new Group($group_id);
            if (fRequest::isPost()) {
                $group->populate();
                fRequest::validateCSRFToken(fRequest::get('token'));
                $group->store();
                fMessaging::create('success', "/" . Group::makeURL("list"), 'The Group ' . $group->getName() . ' was successfully updated');
                fURL::redirect(Group::makeUrl('list'));
            }
        } catch (fNotFoundException $e) {
            fMessaging::create('error', "/" . Group::makeUrl('list'), 'The Group requested, ' . fHTML::encode($group_id) . ', could not be found');
            fURL::redirect(Group::makeUrl('list'));
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e->getMessage());
        }
        include VIEW_PATH . '/add_edit_group.php';
    }
    // --------------------------------- //
} elseif ('add' == $action) {
    $group = new Group();
    if (fRequest::isPost()) {
        try {
            $group->populate();
            fRequest::validateCSRFToken(fRequest::get('token'));
            $group->store();
            $group_url = fURL::redirect(Group::makeUrl('list'));
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:groups.php

示例13: elseif

} elseif ('edit' == $action) {
  try {
    $subscription = new Subscription($subscription_id);
    $check = new Check($subscription->getCheck_Id());
    if (fRequest::isPost()) {
      $subscription->populate();
      fRequest::validateCSRFToken(fRequest::get('token'));
      $subscription->store();
      fMessaging::create('affected', fURL::get(), $check->getName());
      fMessaging::create('success', fURL::get(), 
                         'The subscription to check ' . $check->getName(). ' was successfully updated');
			//fURL::redirect($manage_url);	
    }
  } catch (fNotFoundException $e) {
    fMessaging::create('error', $manage_url, 
                       'The subscription requested ' . fHTML::encode($check_id) . ' could not be found');
    fURL::redirect($manage_url);
  } catch (fExpectedException $e) {
    fMessaging::create('error', fURL::get(), $e->getMessage());	
  }

  include VIEW_PATH . '/add_edit_subscription.php';
	
// --------------------------------- //
} elseif ('add' == $action) {
  $subscription = new Subscription();

  //Load details of the check we are going to subscribe to
  $check = new Check($check_id);

  if (fRequest::isPost()) {	
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:31,代码来源:subscription.php

示例14: Markdown

<?php

$title = $this->problem->getTitle();
include __DIR__ . '/../layout/header.php';
?>
<div class="page-header">
  <h1><?php 
echo $this->problem->getId();
?>
. <?php 
echo fHTML::encode($this->problem->getTitle());
?>
</h1>
</div>
<div class="row">
  <article class="span9"><?php 
echo Markdown($this->problem->getDescription());
?>
</article>
  <aside class="span3">
    <div class="well">
      <a class="btn btn-primary btn-large" href="<?php 
echo SITE_BASE;
?>
/submit?problem=<?php 
echo $this->problem->getId();
?>
">提交此题</a>
    </div>
  </aside>
</div>
开发者ID:daerduoCarey,项目名称:oj,代码行数:31,代码来源:show.php

示例15: array

$sort = fRequest::getValid('sort', array('name'), 'name');
$sortby = fRequest::getValid('sortby', array('asc', 'desc'), 'asc');
// --------------------------------- //
if ('edit' == $action) {
    try {
        $dashboard = new Dashboard($dashboard_id);
        $graphs = Graph::findAll($dashboard_id);
        if (fRequest::isPost()) {
            $dashboard->populate();
            fRequest::validateCSRFToken(fRequest::get('token'));
            $dashboard->store();
            fMessaging::create('affected', fURL::get(), $dashboard->getName());
            fMessaging::create('success', fURL::get(), 'The Dashboard ' . $dashboard->getName() . ' was successfully updated');
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', Dashboard::makeUrl('list'), 'The Dashboard requested ' . fHTML::encode($dashboard_id) . 'could not be found');
        fURL::redirect(Dashboard::makeUrl('list'));
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/add_edit_dashboard.php';
    // --------------------------------- //
} elseif ('add' == $action) {
    $dashboard = new Dashboard();
    if (fRequest::isPost()) {
        try {
            $dashboard->populate();
            fRequest::validateCSRFToken(fRequest::get('token'));
            $dashboard->store();
            fMessaging::create('affected', fURL::get(), $dashboard->getName());
            fMessaging::create('success', fURL::get(), 'The Dashboard ' . $dashboard->getName() . ' was successfully created');
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:dashboard.php


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