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


PHP int_escape函数代码示例

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


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

示例1: onPageRequest

 public function onPageRequest($event)
 {
     global $config, $page, $user;
     if ($event->page_matches("featured_image")) {
         if ($event->get_arg(0) == "set" && $user->check_auth_token()) {
             if ($user->is_admin() && isset($_POST['image_id'])) {
                 $id = int_escape($_POST['image_id']);
                 if ($id > 0) {
                     $config->set_int("featured_id", $id);
                     $page->set_mode("redirect");
                     $page->set_redirect(make_link("post/view/{$id}"));
                 }
             }
         }
         if ($event->get_arg(0) == "download") {
             $image = Image::by_id($config->get_int("featured_id"));
             if (!is_null($image)) {
                 $page->set_mode("data");
                 $page->set_type("image/jpeg");
                 $page->set_data(file_get_contents($image->get_image_filename()));
             }
         }
         if ($event->get_arg(0) == "view") {
             $image = Image::by_id($config->get_int("featured_id"));
             if (!is_null($image)) {
                 send_event(new DisplayingImageEvent($image, $page));
             }
         }
     }
 }
开发者ID:nsuan,项目名称:shimmie2,代码行数:30,代码来源:main.php

示例2: get_list_pageinfo

 /**
  * Returns info about the current page number.
  *
  * @param PageRequestEvent $event
  * @return array
  */
 private function get_list_pageinfo(PageRequestEvent $event)
 {
     global $config, $database;
     // get the amount of images per page
     $images_per_page = $config->get_int('index_images');
     // if there are no tags, use default
     if (is_null($event->get_arg(1))) {
         $prefix = "";
         $page_number = int_escape($event->get_arg(0));
         $total_pages = ceil($database->get_one("SELECT COUNT(*) FROM images") / $images_per_page);
     } else {
         // if there are tags, use pages with tags
         $prefix = url_escape($event->get_arg(0)) . "/";
         $page_number = int_escape($event->get_arg(1));
         $total_pages = ceil($database->get_one("SELECT count FROM tags WHERE tag=:tag", array("tag" => $event->get_arg(0))) / $images_per_page);
     }
     // creates previous & next values
     // When previous first page, go to last page
     if ($page_number <= 1) {
         $prev = $total_pages;
     } else {
         $prev = $page_number - 1;
     }
     if ($page_number >= $total_pages) {
         $next = 1;
     } else {
         $next = $page_number + 1;
     }
     // Create return array
     $pageinfo = array("prev" => $prefix . $prev, "next" => $prefix . $next);
     return $pageinfo;
 }
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:38,代码来源:main.php

示例3: comment_to_html

 protected function comment_to_html($comment, $trim = false)
 {
     $inner_id = $this->inner_id;
     // because custom themes can't add params, because PHP
     global $user;
     $tfe = new TextFormattingEvent($comment->comment);
     send_event($tfe);
     //$i_uid = int_escape($comment->owner_id);
     $h_name = html_escape($comment->owner_name);
     //$h_poster_ip = html_escape($comment->poster_ip);
     $h_comment = $trim ? substr($tfe->stripped, 0, 50) . "..." : $tfe->formatted;
     $i_comment_id = int_escape($comment->comment_id);
     $i_image_id = int_escape($comment->image_id);
     $stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
     $stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
     $h_userlink = "<a href='" . make_link("user/{$h_name}") . "'>{$h_name}</a>";
     $h_date = $comment->posted;
     $h_del = $user->can("delete_comment") ? ' - <a onclick="return confirm(\'Delete comment by ' . $h_name . ':\\n' . $stripped_nonl . '\');" ' . 'href="' . make_link('comment/delete/' . $i_comment_id . '/' . $i_image_id) . '">Del</a>' : '';
     $h_reply = "[<a href='" . make_link("post/view/{$i_image_id}") . "'>Reply</a>]";
     if ($inner_id == 0) {
         return "<div class='comment' style='margin-top: 8px;'>{$h_userlink}{$h_del} {$h_date} No.{$i_comment_id} {$h_reply}<p>{$h_comment}</p></div>";
     } else {
         return "<table><tr><td nowrap class='doubledash'>&gt;&gt;</td><td>" . "<div class='reply'>{$h_userlink}{$h_del} {$h_date} No.{$i_comment_id} {$h_reply}<p>{$h_comment}</p></div>" . "</td></tr></table>";
     }
 }
开发者ID:JarJak,项目名称:shimmie2,代码行数:25,代码来源:comment.theme.php

示例4: display_image_banner

 public function display_image_banner(Page $page, Image $image)
 {
     global $config;
     $i_image = int_escape($image->id);
     $html = "\n\t\t\t<form action='" . make_link("image_report/add") . "' method='POST'>\n\t\t\t\t<input type='hidden' name='image_id' value='{$i_image}'>\n\t\t\t\t<input type='text' name='reason' value='Please enter a reason' onclick='this.value=\"\";'>\n\t\t\t\t<input type='submit' value='Report'>\n\t\t\t</form>\n\t\t";
     $page->add_block(new Block("Report Image", $html, "left"));
 }
开发者ID:jackrabbitjoey,项目名称:shimmie2,代码行数:7,代码来源:theme.php

示例5: get_voter_html

 public function get_voter_html(Image $image)
 {
     $i_image_id = int_escape($image->id);
     $i_score = int_escape($image->numeric_score);
     $html = "\n\t\t\tCurrent Score: {$i_score}\n\n\t\t\t<p><form action='" . make_link("numeric_score_vote") . "' method='POST'>\n\t\t\t<input type='hidden' name='image_id' value='{$i_image_id}'>\n\t\t\t<input type='hidden' name='vote' value='up'>\n\t\t\t<input type='submit' value='Vote Up'>\n\t\t\t</form>\n\n\t\t\t<form action='" . make_link("numeric_score_vote") . "' method='POST'>\n\t\t\t<input type='hidden' name='image_id' value='{$i_image_id}'>\n\t\t\t<input type='hidden' name='vote' value='null'>\n\t\t\t<input type='submit' value='Remove Vote'>\n\t\t\t</form>\n\n\t\t\t<form action='" . make_link("numeric_score_vote") . "' method='POST'>\n\t\t\t<input type='hidden' name='image_id' value='{$i_image_id}'>\n\t\t\t<input type='hidden' name='vote' value='down'>\n\t\t\t<input type='submit' value='Vote Down'>\n\t\t\t</form>\n\t\t";
     return $html;
 }
开发者ID:jackrabbitjoey,项目名称:shimmie2,代码行数:7,代码来源:theme.php

示例6: build_thumb_html

 /**
  * Generic thumbnail code; returns HTML rather than adding
  * a block since thumbs tend to go inside blocks...
  */
 public function build_thumb_html(Image $image, $query = null)
 {
     global $config;
     $i_id = int_escape($image->id);
     $h_view_link = make_link("post/view/{$i_id}", $query);
     $h_thumb_link = $image->get_thumb_link();
     // Removes the size tag if the file is an mp3
     if ($image->ext == 'mp3') {
         $iitip = $image->get_tooltip();
         $mp3tip = array("0x0");
         $h_tip = str_replace($mp3tip, " ", $iitip);
         // Makes it work with a variation of the default tooltips (I.E $tags // $filesize // $size)
         $justincase = array("   //", "//   ", "  //", "//  ", "  ");
         if (strstr($h_tip, "  ")) {
             $h_tip = html_escape(str_replace($justincase, "", $h_tip));
         } else {
             $h_tip = html_escape($h_tip);
         }
     } else {
         $h_tip = html_escape($image->get_tooltip());
     }
     // If file is flash or svg then sets thumbnail to max size.
     if ($image->ext == 'swf' || $image->ext == 'svg') {
         $tsize = get_thumbnail_size($config->get_int('thumb_width'), $config->get_int('thumb_height'));
     } else {
         $tsize = get_thumbnail_size($image->width, $image->height);
     }
     return "\n\t\t\t<center><div class='thumbblock'>\n\t\t\t\n\t\t\t\t<a href='{$h_view_link}' style='position: relative; display: block; height: {$tsize[1]}px; width: {$tsize[0]}px;'>\n\t\t\t\t\t<img id='thumb_{$i_id}' title='{$h_tip}' alt='{$h_tip}' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='{$h_thumb_link}'>\n\t\t\t\t</a>\n\t\t\t\n\t\t\t</div></center>\n\t\t";
 }
开发者ID:nsuan,项目名称:shimmie2,代码行数:33,代码来源:themelet.class.php

示例7: get_voter_html

 public function get_voter_html(Image $image, $is_favorited)
 {
     $i_image_id = int_escape($image->id);
     $name = $is_favorited ? "unset" : "set";
     $label = $is_favorited ? "Un-Favorite" : "Favorite";
     $html = "\n\t\t\t" . make_form(make_link("change_favorite")) . "\n\t\t\t<input type='hidden' name='image_id' value='{$i_image_id}'>\n\t\t\t<input type='hidden' name='favorite_action' value='{$name}'>\n\t\t\t<input type='submit' value='{$label}'>\n\t\t\t</form>\n\t\t";
     return $html;
 }
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:8,代码来源:theme.php

示例8: get_resize_html

 public function get_resize_html($image_id)
 {
     global $user;
     global $config;
     $i_image_id = int_escape($image_id);
     $html = "\n\t\t\t" . make_form(make_link("resize"), 'POST', false, 'resize_image') . "\n\t\t\t\t<input type='hidden' name='image_id' value='{$i_image_id}' />\n\t\t\t\t<input type='submit' value='Resize' id='resize_image_submit' />\n\t\t\t</form>\n\t\t";
     return $html;
 }
开发者ID:nsuan,项目名称:shimmie2,代码行数:8,代码来源:theme.php

示例9: User

 /**
  * One will very rarely construct a user directly, more common
  * would be to use User::by_id, User::by_session, etc
  */
 public function User($row)
 {
     $this->id = int_escape($row['id']);
     $this->name = $row['name'];
     $this->email = $row['email'];
     $this->join_date = $row['joindate'];
     $this->admin = $row['admin'] == 'Y';
 }
开发者ID:kmcasto,项目名称:shimmie2,代码行数:12,代码来源:user.class.php

示例10: onPageRequest

 public function onPageRequest($event)
 {
     global $config, $database, $page, $user;
     if ($event->page_matches("regen_thumb") && $user->is_admin() && isset($_POST['image_id'])) {
         $image = Image::by_id(int_escape($_POST['image_id']));
         send_event(new ThumbnailGenerationEvent($image->hash, $image->ext));
         $this->theme->display_results($page, $image);
     }
 }
开发者ID:kmcasto,项目名称:shimmie2,代码行数:9,代码来源:main.php

示例11: onPageRequest

 public function onPageRequest(PageRequestEvent $event)
 {
     global $page, $user;
     if ($event->page_matches("regen_thumb") && $user->can("delete_image") && isset($_POST['image_id'])) {
         $image = Image::by_id(int_escape($_POST['image_id']));
         send_event(new ThumbnailGenerationEvent($image->hash, $image->ext, true));
         $this->theme->display_results($page, $image);
     }
 }
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:9,代码来源:main.php

示例12: get_rater_html

 public function get_rater_html($image_id, $rating)
 {
     $i_image_id = int_escape($image_id);
     $s_checked = $rating == 's' ? " checked" : "";
     $q_checked = $rating == 'q' ? " checked" : "";
     $e_checked = $rating == 'e' ? " checked" : "";
     $html = "\n\t\t\t<tr>\n\t\t\t\t<td>Rating</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type='radio' name='rating' value='s' id='s'{$s_checked}><label for='s'>Safe</label>\n\t\t\t\t\t<input type='radio' name='rating' value='q' id='q'{$q_checked}><label for='q'>Questionable</label>\n\t\t\t\t\t<input type='radio' name='rating' value='e' id='e'{$e_checked}><label for='e'>Explicit</label>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t";
     return $html;
 }
开发者ID:nsuan,项目名称:shimmie2,代码行数:9,代码来源:theme.php

示例13: build_featured_html

 /**
  * @param Image $image
  * @param null|string $query
  * @return string
  */
 public function build_featured_html(Image $image, $query = null)
 {
     $i_id = int_escape($image->id);
     $h_view_link = make_link("post/view/{$i_id}", $query);
     $h_thumb_link = $image->get_thumb_link();
     $h_tip = html_escape($image->get_tooltip());
     $tsize = get_thumbnail_size($image->width, $image->height);
     return "\n\t\t\t<a href='{$h_view_link}'>\n\t\t\t\t<img id='thumb_{$i_id}' title='{$h_tip}' alt='{$h_tip}' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='{$h_thumb_link}'>\n\t\t\t</a>\n\t\t";
 }
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:14,代码来源:theme.php

示例14: build_thumb_html

 /**
  * Generic thumbnail code; returns HTML rather than adding
  * a block since thumbs tend to go inside blocks...
  */
 public function build_thumb_html(Image $image, $query = null)
 {
     global $config;
     $i_id = int_escape($image->id);
     $h_view_link = make_link("post/view/{$i_id}", $query);
     $h_tip = html_escape($image->get_tooltip());
     $h_thumb_link = $image->get_thumb_link();
     $tsize = get_thumbnail_size($image->width, $image->height);
     return "<a class='thumb' href='{$h_view_link}'><img id='{$i_id}' title='{$h_tip}' alt='{$h_tip}' " . "width='{$tsize[0]}' height='{$tsize[1]}' src='{$h_thumb_link}' /></a>";
 }
开发者ID:kmcasto,项目名称:shimmie2,代码行数:14,代码来源:themelet.class.php

示例15: get_voter_html

 public function get_voter_html(Image $image)
 {
     global $user;
     $i_image_id = int_escape($image->id);
     $i_score = int_escape($image->numeric_score);
     $html = "\n\t\t\tCurrent Score: {$i_score}\n\n\t\t\t<p><form action='" . make_link("numeric_score_vote") . "' method='POST'>\n\t\t\t" . $user->get_auth_html() . "\n\t\t\t<input type='hidden' name='image_id' value='{$i_image_id}'>\n\t\t\t<input type='hidden' name='vote' value='up'>\n\t\t\t<input type='submit' value='Vote Up'>\n\t\t\t</form>\n\n\t\t\t<form action='" . make_link("numeric_score_vote") . "' method='POST'>\n\t\t\t" . $user->get_auth_html() . "\n\t\t\t<input type='hidden' name='image_id' value='{$i_image_id}'>\n\t\t\t<input type='hidden' name='vote' value='null'>\n\t\t\t<input type='submit' value='Remove Vote'>\n\t\t\t</form>\n\n\t\t\t<form action='" . make_link("numeric_score_vote") . "' method='POST'>\n\t\t\t" . $user->get_auth_html() . "\n\t\t\t<input type='hidden' name='image_id' value='{$i_image_id}'>\n\t\t\t<input type='hidden' name='vote' value='down'>\n\t\t\t<input type='submit' value='Vote Down'>\n\t\t\t</form>\n\t\t";
     if ($user->is_admin()) {
         $html .= "\n\t\t\t<form action='" . make_link("numeric_score/remove_votes_on") . "' method='POST'>\n\t\t\t" . $user->get_auth_html() . "\n\t\t\t<input type='hidden' name='image_id' value='{$i_image_id}'>\n\t\t\t<input type='submit' value='Remove All Votes'>\n\t\t\t</form>\n\n\t\t\t<p><a href='" . make_link("numeric_score_votes/{$i_image_id}") . "'>See All Votes</a>\n\t\t\t";
     }
     return $html;
 }
开发者ID:nsuan,项目名称:shimmie2,代码行数:11,代码来源:theme.php


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