本文整理汇总了PHP中nggGallery::check_memory_limit方法的典型用法代码示例。如果您正苦于以下问题:PHP nggGallery::check_memory_limit方法的具体用法?PHP nggGallery::check_memory_limit怎么用?PHP nggGallery::check_memory_limit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggGallery
的用法示例。
在下文中一共展示了nggGallery::check_memory_limit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controller
/**
* Render the page content
*
* @return void
*/
function controller()
{
global $ngg, $nggdb;
// check for the max image size
$this->maxsize = nggGallery::check_memory_limit();
//get all galleries (after we added new ones)
$this->gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
$this->defaultpath = $ngg->options['gallerypath'];
// link for the flash file
$swf_upload_link = NGGALLERY_URLPATH . 'admin/upload.php';
// get list of tabs
$tabs = $this->tabs_order();
// with this filter you can add custom file types
$file_types = apply_filters('ngg_swf_file_types', '*.jpg;*.jpeg;*.gif;*.png;*.JPG;*.JPEG;*.GIF;*.PNG');
// Set the post params, which plupload will post back with the file, and pass them through a filter.
$post_params = array("auth_cookie" => is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE], "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE], "_wpnonce" => wp_create_nonce('ngg_swfupload'), "galleryselect" => "0");
$p = array();
foreach ($post_params as $param => $val) {
$val = esc_js($val);
$p[] = "'{$param}' : '{$val}'";
}
$post_params_str = implode(',', $p) . "\n";
?>
<?php
if ($ngg->options['swfUpload'] && !empty($this->gallerylist)) {
?>
<?php
if (defined('IS_WP_3_3')) {
?>
<!-- plupload script -->
<script type="text/javascript">
//<![CDATA[
var resize_height = <?php
echo (int) $ngg->options['imgHeight'];
?>
,
resize_width = <?php
echo (int) $ngg->options['imgWidth'];
?>
;
jQuery(document).ready(function($) {
window.uploader = new plupload.Uploader({
runtimes: '<?php
echo apply_filters('plupload_runtimes', 'html5,flash,silverlight,html4,');
?>
',
browse_button: 'plupload-browse-button',
container: 'plupload-upload-ui',
drop_element: 'uploadimage',
file_data_name: 'Filedata',
max_file_size: '<?php
echo round((int) wp_max_upload_size() / 1024);
?>
kb',
url: '<?php
echo esc_js($swf_upload_link);
?>
',
flash_swf_url: '<?php
echo esc_js(includes_url('js/plupload/plupload.flash.swf'));
?>
',
silverlight_xap_url: '<?php
echo esc_js(includes_url('js/plupload/plupload.silverlight.xap'));
?>
',
filters: [
{title: '<?php
echo esc_js(__('Image Files', 'nggallery'));
?>
', extensions: '<?php
echo esc_js(str_replace(array('*.', ';'), array('', ','), $file_types));
?>
'}
],
multipart: true,
urlstream_upload: true,
multipart_params : {
<?php
echo $post_params_str;
?>
},
debug: false,
preinit : {
Init: function(up, info) {
debug('[Init]', 'Info :', info, 'Features :', up.features);
initUploader();
}
},
i18n : {
'remove' : '<?php
_e('remove', 'nggallery');
?>
//.........这里部分代码省略.........
示例2: controller
/**
* Render the page content
*
* @return void
*/
function controller()
{
global $ngg, $nggdb;
// check for the max image size
$this->maxsize = nggGallery::check_memory_limit();
//get all galleries (after we added new ones)
$this->gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
$this->defaultpath = $ngg->options['gallerypath'];
// link for the flash file
$swf_upload_link = admin_url('/?nggupload');
// get list of tabs
$tabs = $this->tabs_order();
// with this filter you can add custom file types
$file_types = apply_filters('ngg_swf_file_types', '*.jpg;*.jpeg;*.gif;*.png;*.JPG;*.JPEG;*.GIF;*.PNG');
// Set the post params, which plupload will post back with the file, and pass them through a filter.
$post_params = array("auth_cookie" => is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE], "logged_in_cookie" => $_COOKIE[LOGGED_IN_COOKIE], "_wpnonce" => wp_create_nonce('ngg_swfupload'), "galleryselect" => "0");
$p = array();
foreach ($post_params as $param => $val) {
$val = esc_js($val);
$p[] = "'{$param}' : '{$val}'";
}
$post_params_str = implode(',', $p) . "\n";
?>
<div class="wrap ngg-wrap">
<?php
screen_icon('nextgen-gallery');
?>
<h2><?php
_e('Add Gallery / Images', 'nggallery');
?>
</h2>
</div>
<?php
if (!empty($this->gallerylist)) {
?>
<?php
if ($ngg->options['swfUpload']) {
?>
<!-- plupload script -->
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($) {
window.uploader = new plupload.Uploader({
runtimes: '<?php
echo apply_filters('plupload_runtimes', 'html5,flash,silverlight,html4,');
?>
',
browse_button: 'plupload-browse-button',
container: 'plupload-upload-ui',
drop_element: 'uploadimage',
file_data_name: 'Filedata',
url: '<?php
echo esc_js($swf_upload_link);
?>
',
flash_swf_url: '<?php
echo esc_js(includes_url('js/plupload/plupload.flash.swf'));
?>
',
silverlight_xap_url: '<?php
echo esc_js(includes_url('js/plupload/plupload.silverlight.xap'));
?>
',
filters: {
mime_types : [
{title: '<?php
echo esc_js(__('Image Files', 'nggallery'));
?>
', extensions: '<?php
echo esc_js(str_replace(array('*.', ';'), array('', ','), $file_types));
?>
'}
],
max_file_size: '<?php
echo round((int) wp_max_upload_size() / 1024);
?>
kb'
},
multipart: true,
urlstream_upload: true,
multipart_params : {
<?php
echo $post_params_str;
?>
},
<?php
if ($ngg->options['imgAutoResize'] == 1) {
?>
resize: {
width: <?php
echo esc_js($ngg->options['imgWidth']);
?>
,
height: <?php
//.........这里部分代码省略.........
示例3: controller
/**
* Render the page content
*
* @return void
*/
function controller()
{
global $ngg, $nggdb;
// check for the max image size
$this->maxsize = nggGallery::check_memory_limit();
//get all galleries (after we added new ones)
$this->gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
$this->defaultpath = $ngg->options['gallerypath'];
// link for the flash file
$swf_upload_link = NGGALLERY_URLPATH . 'admin/upload.php';
// get list of tabs
$tabs = $this->tabs_order();
// with this filter you can add custom file types
$file_types = apply_filters('ngg_swf_file_types', '*.jpg;*.jpeg;*.gif;*.png;*.JPG;*.JPEG;*.GIF;*.PNG');
?>
<?php
if ($ngg->options['swfUpload'] && !empty($this->gallerylist)) {
?>
<!-- SWFUpload script -->
<script type="text/javascript">
var ngg_swf_upload;
window.onload = function () {
ngg_swf_upload = new SWFUpload({
// Backend settings
upload_url : "<?php
echo esc_attr($swf_upload_link);
?>
",
flash_url : "<?php
echo NGGALLERY_URLPATH;
?>
admin/js/swfupload.swf",
// Button Settings
button_placeholder_id : "spanButtonPlaceholder",
button_width: 300,
button_height: 27,
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
button_cursor: SWFUpload.CURSOR.HAND,
// File Upload Settings
file_size_limit : "<?php
echo wp_max_upload_size();
?>
b",
file_types : "<?php
echo $file_types;
?>
",
file_types_description : "<?php
_e('Image Files', 'nggallery');
?>
",
// Queue handler
file_queued_handler : fileQueued,
// Upload handler
upload_start_handler : uploadStart,
upload_progress_handler : uploadProgress,
upload_error_handler : uploadError,
upload_success_handler : uploadSuccess,
upload_complete_handler : uploadComplete,
post_params : {
"auth_cookie" : "<?php
echo is_ssl() ? $_COOKIE[SECURE_AUTH_COOKIE] : $_COOKIE[AUTH_COOKIE];
?>
",
"logged_in_cookie": "<?php
echo $_COOKIE[LOGGED_IN_COOKIE];
?>
",
"_wpnonce" : "<?php
echo wp_create_nonce('ngg_swfupload');
?>
",
"galleryselect" : "0"
},
// i18names
custom_settings : {
"remove" : "<?php
_e('remove', 'nggallery');
?>
",
"browse" : "<?php
_e('Browse...', 'nggallery');
?>
",
"upload" : "<?php
_e('Upload images', 'nggallery');
?>
//.........这里部分代码省略.........
示例4: nggallery_admin_add_gallery
function nggallery_admin_add_gallery()
{
global $wpdb, $nggdb, $ngg;
// same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
$filepath = admin_url() . 'admin.php?page=' . $_GET['page'];
// check for the max image size
$maxsize = nggGallery::check_memory_limit();
// link for the flash file
$swf_upload_link = NGGALLERY_URLPATH . 'admin/upload.php';
$swf_upload_link = wp_nonce_url($swf_upload_link, 'ngg_swfupload');
//flash doesn't seem to like encoded ampersands, so convert them back here
$swf_upload_link = str_replace('&', '&', $swf_upload_link);
$defaultpath = $ngg->options['gallerypath'];
if ($_POST['addgallery']) {
check_admin_referer('ngg_addgallery');
$newgallery = esc_attr($_POST['galleryname']);
if (!empty($newgallery)) {
nggAdmin::create_gallery($newgallery, $defaultpath);
}
}
if ($_POST['zipupload']) {
check_admin_referer('ngg_addgallery');
if ($_FILES['zipfile']['error'] == 0 || !empty($_POST['zipurl'])) {
nggAdmin::import_zipfile(intval($_POST['zipgalselect']));
} else {
nggGallery::show_error(__('Upload failed!', 'nggallery'));
}
}
if ($_POST['importfolder']) {
check_admin_referer('ngg_addgallery');
$galleryfolder = $_POST['galleryfolder'];
if (!empty($galleryfolder) and $defaultpath != $galleryfolder) {
nggAdmin::import_gallery($galleryfolder);
}
}
if ($_POST['uploadimage']) {
check_admin_referer('ngg_addgallery');
if ($_FILES['imagefiles']['error'][0] == 0) {
$messagetext = nggAdmin::upload_images();
} else {
nggGallery::show_error(__('Upload failed!', 'nggallery'));
}
}
if (isset($_POST['swf_callback'])) {
if ($_POST['galleryselect'] == '0') {
nggGallery::show_error(__('No gallery selected !', 'nggallery'));
} else {
// get the path to the gallery
$galleryID = (int) $_POST['galleryselect'];
$gallerypath = $wpdb->get_var("SELECT path FROM {$wpdb->nggallery} WHERE gid = '{$galleryID}' ");
nggAdmin::import_gallery($gallerypath);
}
}
if (isset($_POST['disable_flash'])) {
check_admin_referer('ngg_addgallery');
$ngg->options['swfUpload'] = false;
update_option('ngg_options', $ngg->options);
}
if (isset($_POST['enable_flash'])) {
check_admin_referer('ngg_addgallery');
$ngg->options['swfUpload'] = true;
update_option('ngg_options', $ngg->options);
}
//get all galleries (after we added new ones)
$gallerylist = $nggdb->find_all_galleries('gid', 'DESC');
?>
<?php
if ($ngg->options['swfUpload']) {
?>
<!-- SWFUpload script -->
<script type="text/javascript">
var ngg_swf_upload;
window.onload = function () {
ngg_swf_upload = new SWFUpload({
// Backend settings
upload_url : "<?php
echo $swf_upload_link;
?>
",
flash_url : "<?php
echo NGGALLERY_URLPATH;
?>
admin/js/swfupload.swf",
// Button Settings
button_placeholder_id : "spanButtonPlaceholder",
button_width: 300,
button_height: 27,
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
button_cursor: SWFUpload.CURSOR.HAND,
// File Upload Settings
file_size_limit : "<?php
echo wp_max_upload_size();
?>
b",
file_types : "*.jpg;*.jpeg;*.gif;*.png",
file_types_description : "<?php
//.........这里部分代码省略.........