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


PHP sanitize_numeric函数代码示例

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


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

示例1: printZDToggleClass

/**
 * Adds the css class necessary for toggling of Zenpage items search results
 *
 * @param string $option "news" or "pages"
 * @param string $c After which result item the toggling should begin. Here to be passed from the results loop.
 */
function printZDToggleClass($option, $c, $number_to_show)
{
    $option = strtolower($option);
    $c = sanitize_numeric($c);
    if ($c > $number_to_show) {
        echo ' class="' . $option . '_extrashow" style="display:none;"';
    }
}
开发者ID:rb26,项目名称:zenphoto,代码行数:14,代码来源:functions.php

示例2: getArguments

function getArguments($request)
{
    // Override if request arguments are not proper
    $arguments = array();
    // Defaults for below
    $arguments['limit'] = 50;
    if (array_key_exists('limit', $request)) {
        $limit = sanitize_numeric($request['limit']);
        // Ignore if it doesn't seem numeric
        if (is_numeric($limit)) {
            $arguments['limit'] = max(min($limit, 50), 1);
        }
    }
    $arguments['maxdistance'] = 10000;
    if (array_key_exists('maxdistance', $request)) {
        $maxdistance = sanitize_numeric($request['maxdistance']);
        if (is_numeric($maxdistance)) {
            // We expect miles from user, convert to meters here for API
            $arguments['maxdistance'] = max(min($maxdistance * 1609.344, 50000), 1000);
        }
    }
    $arguments['minprice'] = null;
    if (array_key_exists('minprice', $request)) {
        $minprice = sanitize_numeric($request['minprice']);
        if (is_numeric($minprice)) {
            $arguments['minprice'] = max(min($minprice, 4), 0);
        }
    }
    $arguments['maxprice'] = null;
    if (array_key_exists('maxprice', $request)) {
        $maxprice = sanitize_numeric($request['maxprice']);
        if (is_numeric($maxprice)) {
            $arguments['maxprice'] = max(min($maxprice, 4), 0);
        }
    }
    // No defaults for below
    if (array_key_exists('zip', $request)) {
        $zip = sanitize_numeric($request['zip']);
        if (is_numeric($zip)) {
            // Remove leading zeros
            $arguments['zip'] = ltrim($zip, "0");
        }
    }
    if (array_key_exists('latitude', $request) && array_key_exists('longitude', $_REQUEST)) {
        $latitude = sanitize_numeric($request['latitude']);
        $longitude = sanitize_numeric($request['longitude']);
        if (is_numeric($latitude) && is_numeric($longitude)) {
            $arguments['latitude'] = $latitude;
            $arguments['longitude'] = $longitude;
        }
    }
    if (array_key_exists('pagetoken', $request)) {
        $pagetoken = sanitize_string($request['pagetoken']);
        $arguments['pagetoken'] = $pagetoken;
    }
    return $arguments;
}
开发者ID:T3hUb3rK1tten,项目名称:quickeats,代码行数:57,代码来源:arguments.inc.php

示例3: quota_save_admin

/**
 * Saves admin custom data
 * Called when an admin is saved
 *
 * @param string $updated true if data has changed
 * @param object $userobj admin user object
 * @param string $i prefix for the admin
 * @param bool $alter will be true if critical admin data may be altered
 * @return bool
 */
function quota_save_admin($updated, $userobj, $i, $alter)
{
    if (isset($_POST[$i . 'quota']) && $alter) {
        $oldquota = $userobj->getQuota();
        $userobj->setQuota(sanitize_numeric($_POST[$i . 'quota']));
        $updated = $oldquota == $userobj->getQuota();
    }
    return $updated;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:19,代码来源:quota_manager.php

示例4: __construct

 function __construct()
 {
     setOptionDefault('magick_max_height', self::$ignore_size);
     setOptionDefault('magick_max_width', self::$ignore_size);
     if (!sanitize_numeric(getOption('magick_max_height'))) {
         setOption('magick_max_height', self::$ignore_size);
     }
     if (!sanitize_numeric(getOption('magick_max_width'))) {
         setOption('magick_max_width', self::$ignore_size);
     }
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:11,代码来源:lib-Imagick.php

示例5: __construct

 function __construct()
 {
     global $_zp_imagick_present;
     if ($_zp_imagick_present) {
         $this->defaultFilter = 'FILTER_LANCZOS';
         $this->defaultFontSize = 18;
         // setOptionDefault('use_imagick', $_zp_imagick_present);
         setOptionDefault('imagick_filter', $this->defaultFilter);
         setOptionDefault('magick_font_size', $this->defaultFontSize);
         if (!sanitize_numeric(getOption('magick_font_size'))) {
             setOption('magick_font_size', $this->defaultFontSize);
         }
         $mem_lim = getOption('magick_mem_lim');
         if (!is_numeric($mem_lim) || $mem_lim < 0) {
             setOption('magick_mem_lim', 0);
         }
     }
 }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:18,代码来源:lib-Imagick.php

示例6: externalLinkBox

function externalLinkBox($prior, $image, $prefix, $subpage, $tagsort)
{
    if ($prior) {
        $prior .= '<br /><hr>';
    }
    if (isset($_SESSION['externalLinksize_' . $prefix])) {
        $size = sanitize_numeric($_SESSION['externalLinksize_' . $prefix]);
        unset($_SESSION['externalLinksize_' . $prefix]);
    } else {
        $size = false;
    }
    $output = $img = '';
    if ($size) {
        $link = $image->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
        $img = ' <img src="' . html_encode(pathurlencode($link)) . '" height="15" width="15" />';
        $output .= '<input type="text" style="width:100%" value="' . html_encode($link) . '" />';
    }
    $output .= gettext('link for image of size:') . ' <input type="text" name="externalLinksize_' . $prefix . '" size="3" value="' . $size . '" />' . $img;
    return $prior . $output;
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:20,代码来源:externalLink.php

示例7: optionVoteStatusSave

 /**
  * Option save handler for the filter
  *
  * @param object $object object being rated
  * @param string $prefix indicator if admin is processing multiple objects
  */
 static function optionVoteStatusSave($object, $prefix)
 {
     if (isset($_POST['rating_status' . $prefix])) {
         $object->set('rating_status', sanitize_numeric($_POST['rating_status' . $prefix]) - 1);
     }
     return $object;
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:13,代码来源:rating.php

示例8: stripSuffix

    $cache_file = $album . "/" . stripSuffix($image) . '_FULL.' . $suffix;
    $cache_path = NULL;
}
$process = $rotate = false;
if (zp_imageCanRotate()) {
    $rotate = getImageRotation($imageobj);
    $process = $rotate;
}
$watermark_use_image = getWatermarkParam($imageobj, WATERMARK_FULL);
if ($watermark_use_image == NO_WATERMARK) {
    $watermark_use_image = '';
} else {
    $process = 2;
}
if (isset($_GET['q'])) {
    $quality = sanitize_numeric($_GET['q']);
} else {
    $quality = getOption('full_image_quality');
}
if (!($process || $force_cache)) {
    // no processing needed
    if (getOption('album_folder_class') != 'external' && $disposal != 'Download') {
        // local album system, return the image directly
        header('Content-Type: image/' . $suffix);
        if (UTF8_IMAGE_URI) {
            header("Location: " . getAlbumFolder(FULLWEBPATH) . pathurlencode($album8) . "/" . rawurlencode($image8));
        } else {
            header("Location: " . getAlbumFolder(FULLWEBPATH) . pathurlencode($album) . "/" . rawurlencode($image));
        }
        exitZP();
    } else {
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:full-image.php

示例9: dirname

    if ($plugin['priority'] & CLASS_PLUGIN) {
        require_once $plugin['path'];
    }
}
require_once dirname(__FILE__) . '/template-functions.php';
if (isset($_REQUEST['album'])) {
    $localrights = ALBUM_RIGHTS;
} else {
    $localrights = NULL;
}
admin_securityChecks($localrights, $return = currentRelativeURL());
XSRFdefender('refresh');
$imageid = '';
if (isset($_GET['refresh'])) {
    if (isset($_GET['id'])) {
        $imageid = sanitize_numeric($_GET['id']);
    }
    $imageid = $_zp_gallery->garbageCollect(true, true, $imageid);
}
if (isset($_GET['prune'])) {
    $type = 'prune&amp;';
    $title = gettext('Refresh Database');
    $finished = gettext('Finished refreshing the database');
    $incomplete = gettext('Database refresh is incomplete');
    $allset = gettext("We are all set to refresh the database");
    $continue = gettext('Continue refreshing the database.');
} else {
    $type = '';
    $title = gettext('Refresh Metadata');
    $finished = gettext('Finished refreshing the metadata');
    $incomplete = gettext('Metadata refresh is incomplete');
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:admin-refresh-metadata.php

示例10: getRSSImageSize

/**
 * Returns the size of the images to be used in the feed.
 *
 * @return int
 */
function getRSSImageSize()
{
    $rssmode = getRSSAlbumsmode();
    if (isset($_GET['size'])) {
        $size = sanitize_numeric($_GET['size']);
    } else {
        $size = NULL;
    }
    if (is_numeric($size) && !is_null($size) && $size < getOption('feed_imagesize')) {
        $size = $size;
    } else {
        if ($rssmode == "albums") {
            $size = getOption('feed_imagesize_albums');
            // un-cropped image size
        } else {
            $size = getOption('feed_imagesize');
            // un-cropped image size
        }
    }
    return $size;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:26,代码来源:functions-rss.php

示例11: printSlideShow

    static function printSlideShow($heading = true, $speedctl = false, $albumobj = "", $imageobj = "", $width = "", $height = "")
    {
        if (!isset($_POST['albumid']) and !is_object($albumobj)) {
            echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
            echo "</div></body></html>";
            exit;
        }
        global $_zp_flash_player, $_zp_current_image, $_zp_current_album, $_zp_gallery;
        //getting the image to start with
        if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
            $imagenumber = $_POST['imagenumber'] - 1;
            // slideshows starts with 0, but zp with 1.
        } elseif (is_object($imageobj)) {
            makeImageCurrent($imageobj);
            $imagenumber = imageNumber() - 1;
        } else {
            $imagenumber = 0;
        }
        // set pagenumber to 0 if not called via POST link
        if (isset($_POST['pagenr'])) {
            $pagenumber = sanitize_numeric($_POST['pagenr']);
        } else {
            $pagenumber = 0;
        }
        // getting the number of images
        if (!empty($_POST['numberofimages'])) {
            $numberofimages = sanitize_numeric($_POST['numberofimages']);
        } elseif (is_object($albumobj)) {
            $numberofimages = $albumobj->getNumImages();
        }
        //getting the album to show
        if (!empty($_POST['albumid']) and !is_object($albumobj)) {
            $albumid = sanitize_numeric($_POST['albumid']);
        } elseif (is_object($albumobj)) {
            $albumid = $albumobj->id;
        } else {
            $albumid = -1;
        }
        // setting the image size
        if (!empty($width) and !empty($height)) {
            $width = sanitize_numeric($width);
            $height = sanitize_numeric($height);
        } else {
            $width = getOption("slideshow_width");
            $height = getOption("slideshow_height");
        }
        $option = getOption("slideshow_mode");
        // jQuery Cycle slideshow config
        // get slideshow data
        $gallery = new Gallery();
        if ($albumid <= 0) {
            // search page
            $dynamic = 2;
            $search = new SearchEngine();
            $params = $_POST['preserve_search_params'];
            $search->setSearchParams($params);
            $images = $search->getImages(0);
            $searchwords = $search->words;
            $searchdate = $search->dates;
            $searchfields = $search->fields;
            $page = $search->page;
            if (empty($_POST['imagenumber'])) {
                $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . abs($albumid));
                $album = new Album($gallery, $albumq['folder']);
                $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
                //$returnpath = rewrite_path('/'.pathurlencode($album->name).'/page/'.$pagenumber,'/index.php?album='.urlencode($album->name).'&page='.$pagenumber);
            } else {
                $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
            }
            $albumtitle = gettext('Search');
        } else {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
            $album = new Album($gallery, $albumq['folder']);
            $albumtitle = $album->getTitle();
            if (!checkAlbumPassword($albumq['folder'], $hint)) {
                echo gettext("This album is password protected!");
                exit;
            }
            $dynamic = $album->isDynamic();
            $images = $album->getImages(0);
            // return path to get back to the page we called the slideshow from
            if (empty($_POST['imagenumber'])) {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
            } else {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode($_POST['imagefile']) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
            }
        }
        // slideshow display section
        switch ($option) {
            case "jQuery":
                $validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp');
                ?>
					<script type="text/javascript">
						$(document).ready(function(){
							$(function() {
								var ThisGallery = '<?php 
                echo html_encode($albumtitle);
                ?>
';
								var ImageList = new Array();
//.........这里部分代码省略.........
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:101,代码来源:Overrides.php

示例12: printLogoAndLinks

?>
</head>
<body>
	<?php 
printLogoAndLinks();
?>
	<div id="main">
		<?php 
printTabs();
?>
		<div id="content">
			<?php 
if (empty($_GET['subpage'])) {
    $page = "";
} else {
    $page = '&amp;subpage=' . sanitize_numeric($_GET['subpage']);
}
$saveitem = $updateitem = gettext('Apply');
if (is_AdminEditPage('newsarticle')) {
    if (!empty($page)) {
        $zenphoto_tabs['news']['subtabs'][gettext('articles')] .= $page;
    }
    $subtab = printSubtabs();
    ?>
				<div id="tab_articles" class="tabbox">
					<?php 
    $admintype = 'newsarticle';
    $additem = gettext('New Article');
    $deleteitem = gettext('Article');
    $themepage = 'news';
    $locked = !checkIfLocked($result);
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:admin-edit.php

示例13: getCurrentAdminNewsPage

/**
 * Get current news page for admin news pagination
 * Addition needed because $_GET['page'] conflict with zenphoto
 * could probably removed now...
 *
 * @return int
 */
function getCurrentAdminNewsPage()
{
    deprecated_function_notify(gettext('Use the Zenpage class method instead.'));
    if (isset($_GET['pagenr'])) {
        $page = sanitize_numeric($_GET['pagenr']);
    } else {
        $page = 1;
    }
    return $page;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:17,代码来源:deprecated-functions.php

示例14: printSubtabs

</h1>
				<?php 
    $images = $album->getImages();
    $subtab = printSubtabs();
    $parent = dirname($album->name);
    if ($parent == '/' || $parent == '.' || empty($parent)) {
        $parent = '';
    } else {
        $parent = '&amp;album=' . $parent . '&amp;tab=subalbuminfo';
    }
    ?>

				<div class="tabbox">
					<?php 
    if (isset($_GET['saved'])) {
        if (sanitize_numeric($_GET['saved'])) {
            ?>
							<div class="messagebox fade-message">
								<h2><?php 
            echo gettext("Image order saved");
            ?>
</h2>
							</div>
							<?php 
        } else {
            if (isset($_GET['bulkmessage'])) {
                $action = sanitize($_GET['bulkmessage']);
                switch ($action) {
                    case 'deleteall':
                        $messagebox = gettext('Selected items deleted');
                        break;
开发者ID:rauldobrota,项目名称:zenphoto,代码行数:31,代码来源:admin-albumsort.php

示例15: sanitize_numeric

        $from_number_display = 1;
    } else {
        $from_number = sanitize_numeric($_GET['from_number']) - 1;
        $from_number_display = sanitize_numeric($_GET['from_number']);
    }
    if (!isset($_GET['to_number'])) {
        $to_number = 50;
        if ($_GET['type'] === "images" and $to_number > $imagecount) {
            $to_number = $imagecount;
        }
        if ($_GET['type'] === "albums" and $to_number > $albumcount) {
            $to_number = $albumcount;
        }
        $to_number_display = $to_number;
    } else {
        $to_number = sanitize_numeric($_GET['to_number']);
        $to_number_display = $to_number;
        if ($from_number < $to_number) {
            $to_number_display = $to_number;
            $to_number = $to_number - $from_number;
        }
    }
    ?>
		<form name="limit" id="limit" action="gallery_statistics.php">
		<label for="from_number"><?php 
    echo gettext("From ");
    ?>
</label>
		<input type ="text" size="10" id="from_number" name="from_number" value="<?php 
    echo $from_number_display;
    ?>
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:31,代码来源:gallery_statistics.php


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