コード例 #1
1
function ac_gallery_get_upload_meta_data()
{
    $plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files', 'alleycat'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => array('_ajax_nonce' => wp_create_nonce('photo-upload'), 'action' => 'photo_gallery_upload'));
    // Get the data values
    $plupload_init = apply_filters('plupload_init', $plupload_init);
    return $plupload_init;
}
コード例 #2
0
 /**
  * Construct Upload parameters.
  *
  * @since 2.3.0
  * @since 2.4.0 Add the $upload_dir_filter_args argument to the $arguments array
  *
  * @param array|string $args {
  *     @type int    $original_max_filesize  Maximum file size in kilobytes. Defaults to php.ini settings.
  *     @type array  $allowed_mime_types     List of allowed file extensions (eg: array( 'jpg', 'gif', 'png' ) ).
  *                                          Defaults to WordPress allowed mime types.
  *     @type string $base_dir               Component's upload base directory. Defaults to WordPress 'uploads'.
  *     @type string $action                 The upload action used when uploading a file, $_POST['action'] must be set
  *                                          and its value must equal $action {@link wp_handle_upload()} (required).
  *     @type string $file_input             The name attribute used in the file input. (required).
  *     @type array  $upload_error_strings   A list of specific error messages (optional).
  *     @type array  $required_wp_files      The list of required WordPress core files. Default: array( 'file' ).
  *     @type int    $upload_dir_filter_args 1 to receive the original Upload dir array in the Upload dir filter, 0 otherwise.
  *                                          Defaults to 0 (optional).
  * }
  */
 public function __construct($args = '')
 {
     // Upload action and the file input name are required parameters.
     if (empty($args['action']) || empty($args['file_input'])) {
         return false;
     }
     // Sanitize the action ID and the file input name.
     $this->action = sanitize_key($args['action']);
     $this->file_input = sanitize_key($args['file_input']);
     /**
      * Max file size defaults to php ini settings or, in the case of
      * a multisite config, the root site fileupload_maxk option
      */
     $this->default_args['original_max_filesize'] = (int) wp_max_upload_size();
     $params = bp_parse_args($args, $this->default_args, $this->action . '_upload_params');
     foreach ($params as $key => $param) {
         if ('upload_error_strings' === $key) {
             $this->{$key} = $this->set_upload_error_strings($param);
             // Sanitize the base dir.
         } elseif ('base_dir' === $key) {
             $this->{$key} = sanitize_title($param);
             // Sanitize the upload dir filter arg to pass.
         } elseif ('upload_dir_filter_args' === $key) {
             $this->{$key} = (int) $param;
             // Action & File input are already set and sanitized.
         } elseif ('action' !== $key && 'file_input' !== $key) {
             $this->{$key} = $param;
         }
     }
     // Set the path/url and base dir for uploads.
     $this->set_upload_dir();
 }
コード例 #3
0
ファイル: Upload.php プロジェクト: jasmun/Noco100
    /**
     * @param $action
     * @param null $submitText
     */
    public function displayForm($action, $submitText = null)
    {
        $bytes = wp_max_upload_size();
        $size = size_format($bytes);
        $upload_dir = IfwPsn_Wp_Proxy_Blog::getUploadDir();
        if ($submitText == null) {
            $submitText = __('Upload', 'ifw');
        }
        if (!empty($upload_dir['error'])) {
            ?>
<div class="error"><p><?php 
            _e('Before you can upload your import file, you will need to fix the following error:');
            ?>
</p>
            <p><strong><?php 
            echo $upload_dir['error'];
            ?>
</strong></p></div><?php 
        } else {
            $allowedExtensions = $this->getMimeTypes() != null ? implode(',', array_unique(array_keys($this->getMimeTypes()))) : null;
            $label = sprintf('Choose a file from your computer (Maximum size: %s%s)', $size, $allowedExtensions !== null ? ', ' . __('allowed extensions: ') . $allowedExtensions : '');
            ?>
            <form enctype="multipart/form-data" id="<?php 
            echo $this->_id;
            ?>
-upload-form" method="post" class="wp-upload-form" action="<?php 
            echo esc_url($action);
            ?>
">
                <?php 
            echo wp_nonce_field($this->_getNonceName());
            ?>
                <p>
                    <label for="upload-<?php 
            echo $this->_id;
            ?>
"><?php 
            echo $label;
            ?>
</label>
                    <input type="file" id="upload-<?php 
            echo $this->_id;
            ?>
" name="<?php 
            echo $this->_id;
            ?>
" size="25" />
                    <input type="hidden" name="action" value="upload" />
                    <input type="hidden" name="max_file_size" value="<?php 
            echo $bytes;
            ?>
" />
                </p>
                <?php 
            submit_button($submitText, 'button');
            ?>
            </form>
        <?php 
        }
    }
コード例 #4
0
 public function test_sync_callable_whitelist()
 {
     // $this->setSyncClientDefaults();
     $callables = array('wp_max_upload_size' => wp_max_upload_size(), 'is_main_network' => Jetpack::is_multi_network(), 'is_multi_site' => is_multisite(), 'main_network_site' => Jetpack_Sync_Functions::main_network_site_url(), 'single_user_site' => Jetpack::is_single_user_site(), 'updates' => Jetpack::get_updates(), 'home_url' => Jetpack_Sync_Functions::home_url(), 'site_url' => Jetpack_Sync_Functions::site_url(), 'has_file_system_write_access' => Jetpack_Sync_Functions::file_system_write_access(), 'is_version_controlled' => Jetpack_Sync_Functions::is_version_controlled(), 'taxonomies' => Jetpack_Sync_Functions::get_taxonomies(), 'post_types' => Jetpack_Sync_Functions::get_post_types(), 'post_type_features' => Jetpack_Sync_Functions::get_post_type_features(), 'rest_api_allowed_post_types' => Jetpack_Sync_Functions::rest_api_allowed_post_types(), 'rest_api_allowed_public_metadata' => Jetpack_Sync_Functions::rest_api_allowed_public_metadata(), 'sso_is_two_step_required' => Jetpack_SSO_Helpers::is_two_step_required(), 'sso_should_hide_login_form' => Jetpack_SSO_Helpers::should_hide_login_form(), 'sso_match_by_email' => Jetpack_SSO_Helpers::match_by_email(), 'sso_new_user_override' => Jetpack_SSO_Helpers::new_user_override(), 'sso_bypass_default_login_form' => Jetpack_SSO_Helpers::bypass_login_forward_wpcom(), 'wp_version' => Jetpack_Sync_Functions::wp_version(), 'get_plugins' => Jetpack_Sync_Functions::get_plugins(), 'active_modules' => Jetpack::get_active_modules(), 'hosting_provider' => Jetpack_Sync_Functions::get_hosting_provider(), 'locale' => get_locale(), 'site_icon_url' => Jetpack_Sync_Functions::site_icon_url());
     if (is_multisite()) {
         $callables['network_name'] = Jetpack::network_name();
         $callables['network_allow_new_registrations'] = Jetpack::network_allow_new_registrations();
         $callables['network_add_new_users'] = Jetpack::network_add_new_users();
         $callables['network_site_upload_space'] = Jetpack::network_site_upload_space();
         $callables['network_upload_file_types'] = Jetpack::network_upload_file_types();
         $callables['network_enable_administration_menus'] = Jetpack::network_enable_administration_menus();
     }
     $this->sender->do_sync();
     foreach ($callables as $name => $value) {
         // TODO: figure out why _sometimes_ the 'support' value of
         // the post_types value is being removed from the output
         if ($name === 'post_types') {
             continue;
         }
         $this->assertCallableIsSynced($name, $value);
     }
     $whitelist_keys = array_keys($this->callable_module->get_callable_whitelist());
     $callables_keys = array_keys($callables);
     // Are we testing all the callables in the defaults?
     $whitelist_and_callable_keys_difference = array_diff($whitelist_keys, $callables_keys);
     $this->assertTrue(empty($whitelist_and_callable_keys_difference), 'Some whitelisted options don\'t have a test: ' . print_r($whitelist_and_callable_keys_difference, 1));
     // Are there any duplicate keys?
     $unique_whitelist = array_unique($whitelist_keys);
     $this->assertEquals(count($unique_whitelist), count($whitelist_keys), 'The duplicate keys are: ' . print_r(array_diff_key($whitelist_keys, array_unique($whitelist_keys)), 1));
 }
コード例 #5
0
 /**
  * Return information about remote site for use in media migration
  *
  * @return bool|null
  */
 public function respond_to_get_remote_media_info()
 {
     add_filter('wpmdb_before_response', array($this, 'scramble'));
     $key_rules = array('action' => 'key', 'remote_state_id' => 'key', 'intent' => 'key', 'sig' => 'string');
     $this->set_post_data($key_rules, 'remote_state_id');
     $filtered_post = $this->filter_post_elements($this->state_data, array('action', 'remote_state_id', 'intent'));
     if (!$this->verify_signature($filtered_post, $this->settings['key'])) {
         $return = array('wpmdb_error' => 1, 'body' => $this->invalid_content_verification_error . ' (#100mf)');
         $this->log_error($return['body'], $filtered_post);
         $result = $this->end_ajax(serialize($return));
         return $result;
     }
     if (defined('UPLOADBLOGSDIR')) {
         $upload_url = home_url(UPLOADBLOGSDIR);
     } else {
         $upload_dir = wp_upload_dir();
         $upload_url = $upload_dir['baseurl'];
         if (is_multisite()) {
             // Remove multisite postfix
             $upload_url = preg_replace('/\\/sites\\/(\\d)+$/', '', $upload_url);
         }
     }
     $return['remote_total_attachments'] = $this->get_local_attachments_count();
     $return['remote_uploads_url'] = $upload_url;
     $return['blogs'] = serialize($this->get_blogs());
     $return['remote_max_upload_size'] = wp_max_upload_size();
     $result = $this->end_ajax(serialize($return));
     return $result;
 }
コード例 #6
0
/**
 * This file manages the theme settings uploading and import operations.
 * Uses the theme page to create a new form for uplaoding the settings
 * Uses WP_Filesystem
*/
function iced_mocha_import_form()
{
    $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
    $size = wp_convert_bytes_to_hr($bytes);
    $upload_dir = wp_upload_dir();
    if (!empty($upload_dir['error'])) {
        ?>
<div class="error"><p><?php 
        _e('Before you can upload your import file, you will need to fix the following error:', 'iced_mocha');
        ?>
</p>
            <p><strong><?php 
        echo $upload_dir['error'];
        ?>
</strong></p></div><?php 
    } else {
        ?>

    <div class="wrap">
		<div style="width:400px;display:block;margin-left:30px;">
        <div id="icon-tools" class="icon32"><br></div>
        <h2><?php 
        echo __('Import Iced Mocha Options', 'iced_mocha');
        ?>
</h2>
        <form enctype="multipart/form-data" id="import-upload-form" method="post" action="">
        	<p><?php 
        _e('Hi! This is where you import the Iced Mocha Theme settings.<i> Please remember that this is still an experimental feature.</i>', 'iced_mocha');
        ?>
</p>
            <p>
                <label for="upload"><strong><?php 
        _e('Just choose a file from your computer:', 'iced_mocha');
        ?>
 </strong><i>(iced_mocha-settings.txt)</i></label>
		       <input type="file" id="upload" name="import" size="25"  />
				<span style="font-size:10px;">(<?php 
        printf(__('Maximum size: %s', 'iced_mocha'), $size);
        ?>
 )</span>
                <input type="hidden" name="action" value="save" />
                <input type="hidden" name="max_file_size" value="<?php 
        echo $bytes;
        ?>
" />
                <?php 
        wp_nonce_field('iced_mocha-import', 'iced_mocha-import');
        ?>
                <input type="hidden" name="iced_mocha_import_confirmed" value="true" />
            </p>
            <input type="submit" class="button" value="<?php 
        _e('And import!', 'iced_mocha');
        ?>
" />
        </form>
	</div>
    </div> <!-- end wrap -->
    <?php 
    }
}
コード例 #7
0
 function get_max_upload()
 {
     if (function_exists('wp_max_upload_size')) {
         return wp_max_upload_size();
     } else {
         return ini_get('upload_max_filesize') . 'b';
     }
 }
コード例 #8
0
 /**
  * @return array List of items to display.
  */
 public function getSections()
 {
     if (empty($this->sections)) {
         $this->sections = array(array('title' => __('Get System Information', 'jigoshop'), 'id' => 'get-system-information', 'description' => __('Please copy and paste this information in your ticket when contacting support', 'jigoshop'), 'fields' => array(array('id' => 'debug_report', 'title' => '', 'generate_button_id' => 'generate-report', 'debug_textarea_id' => 'report-for-support', 'generate_button_label' => __('Generate Report', 'jigoshop'), 'type' => 'user_defined', 'display' => function ($field) {
             return Render::output('admin/system_info/debug_report', $field);
         }))), array('title' => __('WordPress Environment', 'jigoshop'), 'id' => 'wordpress-environment', 'fields' => array(array('id' => 'home-url', 'name' => 'home-url', 'title' => __('Home URL', 'jigoshop'), 'tip' => __('The URL of your site\'s homepage.', 'jigoshop'), 'type' => 'constant', 'value' => home_url()), array('id' => 'site-url', 'name' => 'site-url', 'title' => __('Site URL', 'jigoshop'), 'tip' => __('The root URL of your site.', 'jigoshop'), 'type' => 'constant', 'value' => site_url()), array('id' => 'jigoshop-version', 'name' => 'jigoshop-version', 'title' => __('Jigoshop Version', 'jigoshop'), 'tip' => __('The version of Jigoshop installed on your site.', 'jigoshop'), 'type' => 'constant', 'value' => Core::VERSION), array('id' => 'jigoshop-database-version', 'name' => 'jigoshop-database-version', 'title' => __('Jigoshop Database Version', 'jigoshop'), 'tip' => __('The version of jigoshop that the database is formatted for. This should be the same as your jigoshop Version.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->getOption('jigoshop-database-version')), array('id' => 'log-directory-writable', 'name' => 'log-directory-writable', 'title' => __('Log Directory Writable', 'jigoshop'), 'tip' => __('Several Jigoshop extensions can write logs which makes debugging problems easier. The directory must be writable for this to happen.', 'jigoshop'), 'description' => sprintf(__('To allow logging, make <code>%s</code> writable or define a custom <code>JIGOSHOP_LOG_DIR</code>.', 'jigoshop'), JIGOSHOP_LOG_DIR), 'type' => 'constant', 'value' => $this->checkLogDirectory() ? $this->yes : $this->no), array('id' => 'wp-version', 'name' => 'wp-version', 'title' => __('WP Version', 'jigoshop'), 'tip' => __('The version of WordPress installed on your site.', 'jigoshop'), 'type' => 'constant', 'value' => get_bloginfo('version')), array('id' => 'wp-multisite', 'name' => 'wp-multisite', 'title' => __('WP Multisite', 'jigoshop'), 'tip' => __('The maximum amount of memory (RAM) that your site can use at one time.', 'jigoshop'), 'type' => 'constant', 'value' => is_multisite() ? $this->yes : $this->no), array('id' => 'wp-memory-limit', 'name' => 'wp-memory-limit', 'title' => __('WP Memory Limit', 'jigoshop'), 'tip' => __('The maximum amount of memory (RAM) that your site can use at one time.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkMemoryLimit(WP_MEMORY_LIMIT, JIGOSHOP_REQUIRED_WP_MEMORY)), array('id' => 'wp-debug-mode', 'name' => 'wp-debug-mode', 'title' => __('WP Debug Mode', 'jigoshop'), 'tip' => __('Displays whether or not WordPress is in Debug Mode.', 'jigoshop'), 'type' => 'constant', 'value' => defined('WP_DEBUG') && WP_DEBUG ? $this->yes : $this->no), array('id' => 'language', 'name' => 'language', 'title' => __('Language', 'jigoshop'), 'tip' => __('The current language used by WordPress. Default = English.', 'jigoshop'), 'type' => 'constant', 'value' => get_locale()))), array('title' => __('Server Environment', 'jigoshop'), 'id' => 'srever-environment', 'fields' => array(array('id' => 'server-info', 'name' => 'server-info', 'title' => __('Server Info', 'jigoshop'), 'tip' => __('Information about the web server that is currently hosting your site.', 'jigoshop'), 'type' => 'constant', 'value' => esc_html($_SERVER['SERVER_SOFTWARE'])), array('id' => 'php-version', 'name' => 'php-version', 'title' => __('PHP Version', 'jigoshop'), 'tip' => __('The version of PHP installed on your hosting server.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkPhpVersion(PHP_VERSION, JIGOSHOP_PHP_VERSION)), array('id' => 'php-post-max-size', 'name' => 'php-post-max-size', 'title' => __('PHP Post Max Size', 'jigoshop'), 'tip' => __('The largest filesize that can be contained in one post.', 'jigoshop'), 'type' => 'constant', 'value' => size_format($this->letterToNumber($this->iniGet('post_max_size')))), array('id' => 'php-time-limit', 'name' => 'php-time-limit', 'title' => __('PHP Time Limit', 'jigoshop'), 'tip' => __('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'jigoshop'), 'type' => 'constant', 'value' => size_format($this->letterToNumber($this->iniGet('post_max_size')))), array('id' => 'php-time-limit', 'name' => 'php-time-limit', 'title' => __('PHP Max Input Vars', 'jigoshop'), 'tip' => __('The maximum number of variables your server can use for a single function to avoid overloads.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('max_input_vars')), array('id' => 'suhosin-installed', 'name' => 'suhosin-installed', 'title' => __('SUHOSIN Installed', 'jigoshop'), 'tip' => __('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'jigoshop'), 'type' => 'constant', 'value' => extension_loaded('suhosin') ? $this->yes : $this->no), array('id' => 'eaccelerator', 'name' => 'eaccelerator', 'title' => __('eAccelerator', 'jigoshop'), 'classes' => array('system-data'), 'tip' => __('eAccelerator is deprecated and causes problems with Jigoshop.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('eaccelerator.enable') == 1 ? $this->yes : $this->no), array('id' => 'apc', 'name' => 'apc', 'title' => __('APC', 'jigoshop'), 'tip' => __('APC is deprecated and causes problems with Jigoshop.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('apc.enable') == 1 ? $this->yes : $this->no), array('id' => 'apc', 'name' => 'apc', 'title' => __('OpCache', 'jigoshop'), 'tip' => __('OpCache is new PHP optimizer and it is recommended to use with Jigoshop.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('opcache.enable') == 1 ? $this->yes : $this->no), array('id' => 'short-open-tag', 'name' => 'short-open-tag', 'title' => __('Short Open Tag', 'jigoshop'), 'tip' => __('Whether short tags are enabled, they are used by some older extensions.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('short-open-tag') != '' ? $this->yes : $this->no), array('id' => 'allow-url-fopen', 'name' => 'allow-url-fopen', 'title' => __('Allow URL fopen', 'jigoshop'), 'tip' => __('Whether fetching remote files is allowed. This option is used by many Jigoshop extensions.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('allow_url_fopen') != '' ? $this->yes : $this->no), array('id' => 'session', 'name' => 'session', 'title' => __('Session', 'jigoshop'), 'tip' => __('Whether fetching remote files is allowed. This option is used by many Jigoshop extensions.', 'jigoshop'), 'type' => 'constant', 'value' => session_id() != null && isset($_SESSION) ? $this->yes : $this->no), array('id' => 'cookie-path', 'name' => 'cookie-path', 'title' => __('Cookie Path', 'jigoshop'), 'tip' => __('Path for which cookies are saved. This is important for sessions and session security.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('session.cookie_path')), array('id' => 'save-path', 'name' => 'save-path', 'title' => __('Save Path', 'jigoshop'), 'tip' => __('Path where sessions are stored on the server. This is sometimes cause of login/logout problems.', 'jigoshop'), 'type' => 'constant', 'value' => esc_html($this->iniGet('session.save_path'))), array('id' => 'use-cookies', 'name' => 'use-cookies', 'title' => __('Use Cookies', 'jigoshop'), 'tip' => __('Whether cookies are used to store PHP session on user\'s computer. Recommended.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('session.use_cookies') != '' ? $this->yes : $this->no), array('id' => 'use-only-cookies', 'name' => 'use-only-cookies', 'title' => __('Use Only Cookies', 'jigoshop'), 'tip' => __('Whether PHP uses only cookies to handle user sessions. This is important for security reasons.', 'jigoshop'), 'type' => 'constant', 'value' => $this->iniGet('session.use_only_cookies') != '' ? $this->yes : $this->no), array('id' => 'max-upload-size', 'name' => 'max-upload-size', 'title' => __('Max Upload Size', 'jigoshop'), 'tip' => __('The largest filesize that can be uploaded to your WordPress installation.', 'jigoshop'), 'type' => 'constant', 'value' => size_format(wp_max_upload_size())), array('id' => 'default-timezone', 'name' => 'default-timezone', 'title' => __('Default Timezone', 'jigoshop'), 'tip' => __('The default timezone for your server. We recommend to set it as UTC.', 'jigoshop'), 'type' => 'constant', 'value' => date_default_timezone_get()), array('id' => 'fsockopen-curl', 'name' => 'fsockopen-curl', 'title' => __('fsockopen/cURL', 'jigoshop'), 'tip' => __('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'jigoshop'), 'type' => 'constant', 'value' => function_exists('fsockopen') || function_exists('curl_init') ? $this->yes : $this->no), array('id' => 'soap-client', 'name' => 'soap-client', 'title' => __('SoapClient', 'jigoshop'), 'tip' => __('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'jigoshop'), 'type' => 'constant', 'value' => class_exists('SoapClient') ? $this->yes : $this->no), array('id' => 'wp-remote-post', 'name' => 'wp-remote-post', 'title' => __('Remote Post', 'jigoshop'), 'tip' => __('PayPal uses this method of communicating when sending back transaction information.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkRemoteRequest('post') ? $this->yes : $this->no), array('id' => 'wp-remote-get', 'name' => 'wp-remote-get', 'title' => __('Remote Get', 'jigoshop'), 'tip' => __('PayJigoshop plugins may use this method of communication when checking for plugin updates.', 'jigoshop'), 'type' => 'constant', 'value' => $this->checkRemoteRequest('get') ? $this->yes : $this->no))), array('title' => __('Server Locale', 'jigoshop'), 'id' => 'srever-locale', 'fields' => array(array('id' => 'decimal-point', 'name' => 'decimal-point', 'title' => __('Decimal Point', 'jigoshop'), 'tip' => __('The character used for decimal points.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('decimal_point') ? $this->getServerLocale('decimal_point') : $this->no), array('id' => 'thousands-sep', 'name' => 'thousands-sep', 'title' => __('Thousands Separator', 'jigoshop'), 'tip' => __('The character used for a thousands separator.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('thousands_sep') ? $this->getServerLocale('thousands_sep') : $this->no), array('id' => 'mon-decimal-point', 'name' => 'mon-decimal-point', 'title' => __('Monetary Decimal Point', 'jigoshop'), 'tip' => __('The character used for decimal points in monetary values.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('mon_decimal_point') ? $this->getServerLocale('mon_decimal_point') : $this->no), array('id' => 'mon-thousands-sep', 'name' => 'mon-thousands-sep', 'title' => __('Monetary Thousands Separator', 'jigoshop'), 'tip' => __('The character used for a thousands separator in monetary values.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getServerLocale('mon_thousands_sep') ? $this->getServerLocale('mon_thousands_sep') : $this->no))), array('title' => sprintf(__('Active Plugins (%s)', 'jigoshop'), count((array) $this->wp->getOption('active_plugins'))), 'id' => 'active-plugins', 'fields' => $this->getActivePlugins()), array('title' => __('Settings', 'jigoshop'), 'id' => 'settings', 'fields' => array(array('id' => 'force-ssl', 'name' => 'force-ssl', 'title' => __('Force SSL', 'jigoshop'), 'tip' => __('Does your site force a SSL Certificate for transactions?', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('shopping.force_ssl') ? $this->yes : $this->no), array('id' => 'shipping-enabled', 'name' => 'shipping-enabled', 'title' => __('Shipping Enabled', 'jigoshop'), 'tip' => __('Does your site have shipping enabled?', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('shipping.enabled') ? $this->yes : $this->no), array('id' => 'currency', 'name' => 'currency', 'title' => __('Shipping Enabled', 'jigoshop'), 'tip' => __('What currency prices are listed at in the catalog and which currency gateways will take payments in?', 'jigoshop'), 'type' => 'constant', 'value' => Currency::code() . '(' . Currency::symbol() . ')'), array('id' => 'currency-position', 'name' => 'currency-position', 'title' => __('Currency Position', 'jigoshop'), 'tip' => __('The position of the currency symbol.', 'jigoshop'), 'type' => 'constant', 'value' => $this->getCurrencyPosition()), array('id' => 'thousand-separator', 'name' => 'thousand-separator', 'title' => __('Thousand Separator', 'jigoshop'), 'tip' => __('The thousand separator of displayed prices.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('general.currency_thousand_separator')), array('id' => 'decimal-separator', 'name' => 'decimal-separator', 'title' => __('Decimal Separator', 'jigoshop'), 'tip' => __('The decimal separator of displayed prices.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('general.currency_decimal_separator')), array('id' => 'number-of-decimals', 'name' => 'number-of-decimals', 'title' => __('Number of Decimals', 'jigoshop'), 'tip' => __('The number of decimal points shown in displayed prices.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('general.currency_decimals')))), array('title' => __('Jigoshop Pages', 'jigoshop'), 'id' => 'jigoshop-pages', 'fields' => array(array('id' => 'shop-base', 'name' => 'shop-base', 'title' => __('Shop Base', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s homepage.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.shop') ? '#' . $this->options->get('advanced.pages.shop') : $this->no), array('id' => 'cart', 'name' => 'cart', 'title' => __('Cart', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s cart page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.cart') ? '#' . $this->options->get('advanced.pages.cart') : $this->no), array('id' => 'checkout', 'name' => 'checkout', 'title' => __('Checkout', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s checkout page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.checkout') ? '#' . $this->options->get('advanced.pages.checkout') : $this->no), array('id' => 'thank-you', 'name' => 'thank-you', 'title' => __('Thank You', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s thank you page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.checkout_thank_you') ? '#' . $this->options->get('advanced.pages.checkout_thank_you') : $this->no), array('id' => 'my-account', 'name' => 'my-account', 'title' => __('My account', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s my account page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.account') ? '#' . $this->options->get('advanced.pages.account') : $this->no), array('id' => 'terms', 'name' => 'terms', 'title' => __('Terms', 'jigoshop'), 'tip' => __('The ID of your Jigoshop shop\'s terms page.', 'jigoshop'), 'type' => 'constant', 'value' => $this->options->get('advanced.pages.terms') ? '#' . $this->options->get('advanced.pages.terms') : $this->no))), array('title' => __('Theme', 'jigoshop'), 'id' => 'theme', 'fields' => array(array('id' => 'name', 'name' => 'name', 'title' => __('Name', 'jigoshop'), 'tip' => __('The name of the current active theme.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->wpGetTheme()->display('Name')), array('id' => 'version', 'name' => 'version', 'title' => __('Version', 'jigoshop'), 'tip' => __('The installed version of the current active theme.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->wpGetTheme()->display('Version')), array('id' => 'author-url', 'name' => 'author-url', 'title' => __('Author URL', 'jigoshop'), 'tip' => __('The theme developers URL.', 'jigoshop'), 'type' => 'constant', 'value' => $this->wp->wpGetTheme()->display('AuthorURI')), array('id' => 'child-theme', 'name' => 'child-theme', 'title' => __('Child Theme', 'jigoshop'), 'tip' => __('Displays whether or not the current theme is a child theme', 'jigoshop'), 'description' => sprintf(__('If you\'re modifying Jigoshop or a parent theme you didn\'t build personally we recommend using a child theme. See: <a href="%s" target="-blank">How to create a child theme</a>', 'jigoshop'), 'https://codex.wordpress.org/Child_Themes'), 'type' => 'constant', 'value' => is_child_theme() ? $this->yes : $this->no), array('id' => 'parent-theme-name', 'name' => 'parent-theme-name', 'title' => __('Parent Theme Name', 'jigoshop'), 'tip' => __('The name of the parent theme.', 'jigoshop'), 'type' => 'constant', 'value' => is_child_theme() ? wp_get_theme($this->wp->wpGetTheme()->display('Template'))->display('Name') : $this->no), array('id' => 'parent-theme-version', 'name' => 'parent-theme-version', 'title' => __('Parent Theme Version', 'jigoshop'), 'tip' => __('The installed version of the parent theme.', 'jigoshop'), 'type' => 'constant', 'value' => is_child_theme() ? wp_get_theme($this->wp->wpGetTheme()->display('Template'))->display('Version') : $this->no), array('id' => 'parent-theme-author-url', 'name' => 'parent-theme-author-url', 'title' => __('Parent Theme Author URL', 'jigoshop'), 'tip' => __('The installed version of the parent theme.', 'jigoshop'), 'type' => 'constant', 'value' => is_child_theme() ? wp_get_theme($this->wp->wpGetTheme()->display('Template'))->display('AuthorURI') : $this->no))), array('title' => __('Templates', 'jigoshop'), 'id' => 'templates', 'description' => __('This section shows any files that are overriding the default jigoshop template pages', 'jigoshop'), 'fields' => $this->getOverrides()));
     }
     return $this->sections;
 }
コード例 #9
0
 /**
  * Returns the maximum upload file size in bytes
  *
  * @param string $size Human readable size
  *
  * @return int Maximum upload file size
  */
 public function get_maximum_upload_file_size_bytes($size)
 {
     $converter_utility = $this->_registry->get('size.converter');
     $maximum_size = $converter_utility->convert_hr_to_bytes($size);
     if ($maximum_size <= 0 || $maximum_size > wp_max_upload_size()) {
         $maximum_size = wp_max_upload_size();
     }
     return $maximum_size;
 }
コード例 #10
0
 /**
  * Enqueue scripts and styles
  *
  * @return void
  */
 static function admin_enqueue_scripts()
 {
     // Enqueue same scripts and styles as for file field
     parent::admin_enqueue_scripts();
     wp_enqueue_style('rwmb-plupload-image', RWMB_CSS_URL . 'plupload-image.css', array('wp-admin'), RWMB_VER);
     wp_enqueue_script('rwmb-plupload-image', RWMB_JS_URL . 'plupload-image.js', array('jquery-ui-sortable', 'wp-ajax-response', 'plupload-all'), RWMB_VER, true);
     wp_localize_script('rwmb-plupload-image', 'RWMB', array('url' => RWMB_URL));
     wp_localize_script('rwmb-plupload-image', 'rwmb_plupload_defaults', array('runtimes' => 'html5,silverlight,flash,html4', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => _x('Allowed Image Files', 'image upload', 'rwmb'), 'extensions' => 'jpg,jpeg,gif,png')), 'multipart' => true, 'urlstream_upload' => true));
 }
コード例 #11
0
ファイル: UploadImage.php プロジェクト: loumray/wpforms
 public function initScripts($page)
 {
     if (!$this->enqueueCheck($page)) {
         return;
     }
     wp_enqueue_script('wpforms-plupload-setup', $this->getBaseUrl() . '/assets/js/plupload-setup.min.js', array('jquery', 'plupload-all'), false, true);
     wp_enqueue_style('wpforms-plupload', $this->getBaseUrl() . '/assets/css/plupload.css');
     self::$params[$this->attributes['id']] = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => $this->attributes['browse_button'], 'container' => $this->attributes['container'], 'drop_element' => $this->attributes['drop_element'], 'file_data_name' => $this->attributes['file_data_name'], 'preview_thumb_id' => $this->attributes['preview_thumb_id'], 'multiple_queues' => false, 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files', 'wpforms'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => array('_ajax_nonce' => wp_create_nonce($this->attributes['ajax_action']), 'action' => $this->attributes['ajax_action']));
 }
コード例 #12
0
 function get_plupload_options()
 {
     $retval = array();
     $retval['runtimes'] = 'gears,browserplus,html5,flash,silverlight,html4';
     $retval['max_file_size'] = strval(round((int) wp_max_upload_size() / 1024)) . 'kb';
     $retval['filters'] = $this->object->get_plupload_filters();
     $retval['flash_swf_url'] = includes_url('js/plupload/plupload.flash.swf');
     $retval['silverlight_xap_url'] = includes_url('js/plupload/plupload.silverlight.xap');
     $retval['debug'] = TRUE;
     return $retval;
 }
コード例 #13
0
 public function wp_limit()
 {
     $output = wp_max_upload_size();
     $output = round($output);
     $output = $output / 1000000;
     //convert to megabytes
     $output = round($output);
     $output = $output * 1000;
     // convert to kilobytes
     return $output;
 }
コード例 #14
0
ファイル: tg-gallery.php プロジェクト: shrtbbbl/happyhoppy
    public function inner_custom_box($post)
    {
        $gallery = get_post_meta($post->ID, 'wpsimplegallery_gallery', true);
        wp_nonce_field(basename(__FILE__), 'wpsimplegallery_gallery_nonce');
        $upload_size_unit = $max_upload_size = wp_max_upload_size();
        $sizes = array('KB', 'MB', 'GB');
        for ($u = -1; $upload_size_unit > 1024 && $u < count($sizes) - 1; $u++) {
            $upload_size_unit /= 1024;
        }
        if ($u < 0) {
            $upload_size_unit = 0;
            $u = 0;
        } else {
            $upload_size_unit = (int) $upload_size_unit;
        }
        $upload_action_url = admin_url('async-upload.php');
        $post_params = array("post_id" => $post->ID, "_wpnonce" => wp_create_nonce('media-form'), "short" => "1");
        $post_params = apply_filters('upload_post_params', $post_params);
        // hook change! old name: 'swfupload_post_params'
        $plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'wpsg-plupload-browse-button', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => $max_upload_size . 'b', 'url' => $upload_action_url, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files', THEMEDOMAIN), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => $post_params);
        ?>
        <script type="text/javascript">
            var POST_ID = <?php 
        echo $post->ID;
        ?>
;
            var WPSGwpUploaderInit = <?php 
        echo json_encode($plupload_init);
        ?>
;
        </script>

        <span class="spinner" id="wpsimplegallyer_spinner"></span>
        <div id="wpsimplegallery_container">
            <ul id="wpsimplegallery_thumbs" class="clearfix"><?php 
        $gallery = is_string($gallery) ? @unserialize($gallery) : $gallery;
        if (is_array($gallery) && count($gallery) > 0) {
            foreach ($gallery as $id) {
                echo $this->admin_thumb($id);
            }
        }
        ?>
            </ul>
        </div>
        <input id="wpsimplegallery_upload_button" data-uploader_title="Upload Image" data-uploader_button_text="Select" style="margin-bottom:8px" class="primary_button button" type="button" value="<?php 
        echo __('Upload Image', 'wpsimplegallery');
        ?>
" rel="" />
        <input id="wpsimplegallery_delete_all_button" class="button secondary_button" type="button" style="margin-bottom:8px" value="<?php 
        echo __('Delete All Images', 'wpsimplegallery');
        ?>
" rel="" />
        <?php 
    }
function hf_load_custom_script()
{
    global $post;
    global $page;
    $show_frontendpost = zl_option('show_frontendpost');
    if (is_user_logged_in() && !is_singular() && $show_frontendpost == 1) {
        wp_enqueue_script('rw-uploader', get_template_directory_uri() . '/lib/js/pl.uploader.js', array('jquery'), '1.0.0', true);
        $plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'gallery', 'drop_element' => 'rw-drag-drop', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => zl_option('lang_allowedfiles', __('Allowed Files', 'zatolab')), 'extensions' => 'jpg,gif,png')), 'multipart' => true, 'urlstream_upload' => true, 'multi_selection' => false, 'multipart_params' => array('_ajax_nonce' => '', 'action' => 'photo_gallery_upload', 'imgid' => 0));
        $plupload_init = apply_filters('rw_uploader_init', $plupload_init);
        wp_localize_script('rw-uploader', 'rwUploaderInit', $plupload_init);
    }
}
コード例 #16
0
/**
 * This file manages the theme settings uploading and import operations.
 * Uses WP_Filesystem
*/
function franz_import_form()
{
    $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
    $size = size_format($bytes, 2);
    $upload_dir = wp_upload_dir();
    if (!empty($upload_dir['error'])) {
        ?>
<div class="error"><p><?php 
        _e('Before you can upload your import file, you will need to fix the following error:', 'franz-josef');
        ?>
</p>
            <p><strong><?php 
        echo $upload_dir['error'];
        ?>
</strong></p></div><?php 
    } else {
        ?>
    <div class="wrap">
        <div id="icon-tools" class="icon32"><br></div>
        <h2><?php 
        echo __('Import Franz Josef Options', 'franz-josef');
        ?>
</h2>    
        <form enctype="multipart/form-data" id="import-upload-form" method="post" action="" onsubmit="return franzCheckFile(this);">
            <p>
                <label for="upload"><?php 
        _e('Choose a file from your computer:', 'franz-josef');
        ?>
</label> (<?php 
        printf(__('Maximum size: %s', 'franz-josef'), $size);
        ?>
)
                <input type="file" id="upload" name="import" size="25" />
                <input type="hidden" name="action" value="save" />
                <input type="hidden" name="max_file_size" value="<?php 
        echo $bytes;
        ?>
" />
                <?php 
        wp_nonce_field('franz-import', 'franz-import');
        ?>
                <input type="hidden" name="franz_import_confirmed" value="true" />
            </p>
            <button type="submit" class="button"><i class="fa fa-upload" style="font-size:16px;margin-right:5px;"></i> <?php 
        _e('Upload file and import', 'franz-josef');
        ?>
</button>
        </form>
    </div> <!-- end wrap -->
    <?php 
    }
}
コード例 #17
0
ファイル: video_upload.php プロジェクト: qhuit/dcosta
    /**
     * Options page callback
     */
    public function pluploadAdminHead()
    {
        // place js config array for plupload
        $plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'plupload-upload-ui', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'dragdrop' => true, 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => 'mp4,avi,3gp,flv')), 'multipart' => true, 'urlstream_upload' => true, 'multi_selection' => false, 'multipart_params' => array('_ajax_nonce' => "", 'action' => 'plupload_action', 'video_id' => 0));
        ?>
        <script type="text/javascript">
        var base_plupload_config=<?php 
        echo json_encode($plupload_init);
        ?>
;
        </script>
    <?php 
    }
コード例 #18
0
ファイル: wpuf.php プロジェクト: alphaomegahost/FIN
 /**
  * Enqueues Styles and Scripts when the shortcodes are used only
  *
  * @uses has_shortcode()
  * @since 0.2
  */
 function enqueue_scripts()
 {
     $path = plugins_url('wp-user-frontend');
     require_once ABSPATH . '/wp-admin/includes/template.php';
     wp_enqueue_style('wpuf', $path . '/css/wpuf.css');
     if (has_shortcode('wpuf_addpost') || has_shortcode('wpuf_edit')) {
         wp_enqueue_script('plupload-handlers');
     }
     wp_enqueue_script('wpuf', $path . '/js/wpuf.js', array('jquery'));
     $posting_msg = wpuf_get_option('updating_label');
     $feat_img_enabled = wpuf_get_option('enable_featured_image') == 'yes' ? true : false;
     wp_localize_script('wpuf', 'wpuf', array('ajaxurl' => admin_url('admin-ajax.php'), 'postingMsg' => $posting_msg, 'confirmMsg' => __('Are you sure?', 'wpuf'), 'nonce' => wp_create_nonce('wpuf_nonce'), 'featEnabled' => $feat_img_enabled, 'plupload' => array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'wpuf-ft-upload-pickfiles', 'container' => 'wpuf-ft-upload-container', 'file_data_name' => 'wpuf_featured_img', 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php') . '?action=wpuf_featured_img&nonce=' . wp_create_nonce('wpuf_featured_img'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true)));
 }
コード例 #19
0
 /**
  * Enqueue scripts and styles
  *
  * @return void
  */
 static function admin_print_styles()
 {
     global $post;
     // Enqueue same scripts and styles as for file field
     parent::admin_print_styles();
     wp_enqueue_script('plupload-all');
     wp_enqueue_style('rwmb-plupload-image', RWMB_CSS_URL . 'plupload-image.css', array(), RWMB_VER);
     wp_enqueue_script('rwmb-plupload-image', RWMB_JS_URL . 'plupload-image.js', array('jquery-ui-sortable', 'wp-ajax-response', 'plupload-all'), RWMB_VER, true);
     //Heartcode Canvas Loader
     wp_enqueue_script('heartcode-canvasloader', 'http://heartcode-canvasloader.googlecode.com/files/heartcode-canvasloader-min-0.9.1.js');
     wp_localize_script('rwmb-plupload-image', 'rwmb_plupload_defaults', array('runtimes' => 'html5,silverlight,flash,html4', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => _x('Allowed Image Files', 'image upload', RWMB_TEXTDOMAIN), 'extensions' => 'jpg,gif,png')), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => array('_ajax_nonce' => wp_create_nonce('plupload_image'), 'action' => 'plupload_image_upload', 'post_id' => $post->ID)));
     //Links to loading and error images to allow preloading
     wp_localize_script('rwmb-plupload-image', 'rwmb_plupload_status_icons', array('error' => RWMB_URL . "img/image-error.gif", 'loading' => RWMB_URL . "img/loading.gif"));
 }
コード例 #20
0
ファイル: importer.php プロジェクト: kalushta/darom
    private function import_upload_form($action)
    {
        $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
        $size = wp_convert_bytes_to_hr($bytes);
        $upload_dir = wp_upload_dir();
        if (!empty($upload_dir['error'])) {
            ?>
<div class="error"><p><?php 
            _e('Before you can upload your import file, you will need to fix the following error:', APP_TD);
            ?>
</p>
	        <p><strong><?php 
            echo $upload_dir['error'];
            ?>
</strong></p></div><?php 
        } else {
            ?>
	<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php 
            echo esc_attr(wp_nonce_url($action, 'import-upload'));
            ?>
">
	<p>
	<label for="upload"><?php 
            _e('Choose a file from your computer:', APP_TD);
            ?>
</label> (<?php 
            printf(__('Maximum size: %s', APP_TD), $size);
            ?>
)
	<input type="file" id="upload" name="import" size="25" />
	<input type="hidden" name="action" value="save" />
	<input type="hidden" name="max_file_size" value="<?php 
            echo $bytes;
            ?>
" />
	</p>
	
	<?php 
            do_action('appthemes_after_import_upload_form');
            ?>
	
	<?php 
            submit_button(__('Upload file and import', APP_TD), 'button');
            ?>
	</form>
	<?php 
        }
    }
コード例 #21
0
ファイル: cpm.php プロジェクト: nizamuddin/wp-project-manager
 function admin_scripts()
 {
     wp_enqueue_script('jquery-ui-core');
     wp_enqueue_script('jquery-ui-dialog');
     wp_enqueue_script('jquery-ui-datepicker');
     wp_enqueue_script('chosen', plugins_url('js/chosen.jquery.min.js', __FILE__));
     wp_enqueue_script('validate', plugins_url('js/jquery.validate.min.js', __FILE__));
     wp_enqueue_script('plupload-handlers');
     wp_enqueue_script('cpm_admin', plugins_url('js/admin.js', __FILE__));
     wp_enqueue_script('cpm_task', plugins_url('js/task.js', __FILE__));
     wp_enqueue_script('cpm_uploader', plugins_url('js/upload.js', __FILE__), array('jquery', 'plupload-handlers'));
     wp_localize_script('cpm_admin', 'CPM_Vars', array('ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('cpm_nonce'), 'plupload' => array('browse_button' => 'cpm-upload-pickfiles', 'container' => 'cpm-upload-container', 'max_file_size' => wp_max_upload_size() . 'b', 'url' => admin_url('admin-ajax.php') . '?action=cpm_ajax_upload&nonce=' . wp_create_nonce('cpm_ajax_upload'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'resize' => array('width' => (int) get_option('large_size_w'), 'height' => (int) get_option('large_size_h'), 'quality' => 100))));
     wp_enqueue_style('cpm_admin', plugins_url('css/admin.css', __FILE__));
     wp_enqueue_style('jquery-ui', plugins_url('css/jquery-ui-1.9.1.custom.css', __FILE__));
     wp_enqueue_style('chosen', plugins_url('css/chosen.css', __FILE__));
 }
コード例 #22
0
 protected function init_tabs()
 {
     $this->tabs->add('info', __('System Info', APP_TD));
     $this->tabs->add('cron', __('Cron Jobs', APP_TD));
     $current_theme = wp_get_theme();
     if (is_child_theme()) {
         $current_theme = wp_get_theme($current_theme->Template);
     }
     $this->tab_sections['info']['theme'] = array('title' => __('Theme Info', APP_TD), 'fields' => array(array('title' => __('Theme Name', APP_TD), 'type' => 'text', 'name' => array('system_info', 'theme_name'), 'extra' => array('style' => 'display: none;'), 'desc' => $current_theme->Name), array('title' => __('Theme Version', APP_TD), 'type' => 'text', 'name' => array('system_info', 'theme_version'), 'extra' => array('style' => 'display: none;'), 'desc' => $current_theme->Version)));
     $this->tab_sections['info']['wp'] = array('title' => __('WordPress Info', APP_TD), 'fields' => array(array('title' => __('Home URL', APP_TD), 'type' => 'text', 'name' => array('system_info', 'home_url'), 'extra' => array('style' => 'display: none;'), 'desc' => home_url()), array('title' => __('Site URL', APP_TD), 'type' => 'text', 'name' => array('system_info', 'site_url'), 'extra' => array('style' => 'display: none;'), 'desc' => site_url()), array('title' => __('Theme Path', APP_TD), 'type' => 'text', 'name' => array('system_info', 'theme_path'), 'extra' => array('style' => 'display: none;'), 'desc' => get_template_directory_uri()), array('title' => __('WP Version', APP_TD), 'type' => 'text', 'name' => array('system_info', 'wp_version'), 'extra' => array('style' => 'display: none;'), 'desc' => is_multisite() ? get_bloginfo('version') . ' - ' . __('Multisite', APP_TD) : get_bloginfo('version')), array('title' => __('WP Memory Limit', APP_TD), 'type' => 'text', 'name' => array('system_info', 'wp_memory_limit'), 'extra' => array('style' => 'display: none;'), 'desc' => size_format(wp_convert_hr_to_bytes(WP_MEMORY_LIMIT))), array('title' => __('WP Max Upload Size', APP_TD), 'type' => 'text', 'name' => array('system_info', 'wp_max_upload_size'), 'extra' => array('style' => 'display: none;'), 'desc' => size_format(wp_max_upload_size())), array('title' => __('WP Debug Mode', APP_TD), 'type' => 'text', 'name' => array('system_info', 'wp_debug_mode'), 'extra' => array('style' => 'display: none;'), 'desc' => defined('WP_DEBUG') && WP_DEBUG ? __('Yes', APP_TD) : __('No', APP_TD)), array('title' => __('Force SSL Admin', APP_TD), 'type' => 'text', 'name' => array('system_info', 'force_ssl_admin'), 'extra' => array('style' => 'display: none;'), 'desc' => defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? __('Yes', APP_TD) : __('No', APP_TD)), array('title' => __('Child Theme', APP_TD), 'type' => 'text', 'name' => array('system_info', 'child_theme'), 'extra' => array('style' => 'display: none;'), 'desc' => is_child_theme() ? __('Yes', APP_TD) : __('No', APP_TD))));
     $this->tab_sections['info']['server'] = array('title' => __('Server Info', APP_TD), 'fields' => array(array('title' => __('Server Software', APP_TD), 'type' => 'text', 'name' => array('system_info', 'server_software'), 'extra' => array('style' => 'display: none;'), 'desc' => $_SERVER['SERVER_SOFTWARE']), array('title' => __('PHP Version', APP_TD), 'type' => 'text', 'name' => array('system_info', 'php_version'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('phpversion') ? phpversion() : __('Function phpversion() is not available.', APP_TD)), array('title' => __('MySQL Version', APP_TD), 'type' => 'text', 'name' => array('system_info', 'mysql_version'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('mysql_get_server_info') ? mysql_get_server_info() : __('Function mysql_get_server_info() is not available.', APP_TD)), array('title' => __('PHP Post Max Size', APP_TD), 'type' => 'text', 'name' => array('system_info', 'post_max_size'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('ini_get') ? size_format(wp_convert_hr_to_bytes(ini_get('post_max_size'))) : __('Function ini_get() is not available.', APP_TD)), array('title' => __('PHP Max Input Vars', APP_TD), 'type' => 'text', 'name' => array('system_info', 'max_input_vars'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('ini_get') ? ini_get('max_input_vars') : __('Function ini_get() is not available.', APP_TD)), array('title' => __('PHP Time Limit', APP_TD), 'type' => 'text', 'name' => array('system_info', 'max_execution_time'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('ini_get') ? ini_get('max_execution_time') : __('Function ini_get() is not available.', APP_TD)), array('title' => __('Upload Max Filesize', APP_TD), 'type' => 'text', 'name' => array('system_info', 'upload_max_filesize'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('ini_get') ? size_format(wp_convert_hr_to_bytes(ini_get('upload_max_filesize'))) : __('Function ini_get() is not available.', APP_TD)), array('title' => __('Display Errors', APP_TD), 'type' => 'text', 'name' => array('system_info', 'display_errors'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('ini_get') ? ini_get('display_errors') ? __('Yes', APP_TD) : __('No', APP_TD) : __('Function ini_get() is not available.', APP_TD)), array('title' => __('SUHOSIN Installed', APP_TD), 'type' => 'text', 'name' => array('system_info', 'suhosin'), 'extra' => array('style' => 'display: none;'), 'desc' => extension_loaded('suhosin') ? __('Yes', APP_TD) : __('No', APP_TD))));
     $this->tab_sections['info']['image'] = array('title' => __('Image Support', APP_TD), 'fields' => array(array('title' => __('GD Library Installed', APP_TD), 'type' => 'text', 'name' => array('system_info', 'gd_library'), 'extra' => array('style' => 'display: none;'), 'desc' => extension_loaded('gd') && function_exists('gd_info') ? __('Yes', APP_TD) : __('No', APP_TD)), array('title' => __('Image Upload Path', APP_TD), 'type' => 'text', 'name' => array('system_info', 'wp_upload_path'), 'extra' => array('style' => 'display: none;'), 'desc' => ($uploads = wp_upload_dir()) ? $uploads['url'] : '')));
     $this->tab_sections['info']['other'] = array('title' => __('Other Checks', APP_TD), 'fields' => array(array('title' => __('JSON Decode', APP_TD), 'type' => 'text', 'name' => array('system_info', 'json_decode'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('json_decode') ? __('Yes', APP_TD) : __('No', APP_TD)), array('title' => __('cURL Enabled', APP_TD), 'type' => 'text', 'name' => array('system_info', 'curl'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('curl_init') ? __('Yes', APP_TD) : __('No', APP_TD)), array('title' => __('fsockopen Enabled', APP_TD), 'type' => 'text', 'name' => array('system_info', 'fsockopen'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('fsockopen') ? __('Yes', APP_TD) : __('No', APP_TD)), array('title' => __('OpenSSL Enabled', APP_TD), 'type' => 'text', 'name' => array('system_info', 'openssl_open'), 'extra' => array('style' => 'display: none;'), 'desc' => function_exists('openssl_open') ? __('Yes', APP_TD) : __('No', APP_TD)), array('title' => __('WP Remote Post', APP_TD), 'type' => 'text', 'name' => array('system_info', 'wp_remote_post'), 'extra' => array('style' => 'display: none;'), 'desc' => $this->test_wp_remote_post() ? __('wp_remote_post() test was successful.', APP_TD) : __('wp_remote_post() test failed.', APP_TD))));
     $this->tab_sections['info']['plugins'] = array('title' => __('Plugins', APP_TD), 'fields' => array(array('title' => __('Installed Plugins', APP_TD), 'type' => 'text', 'name' => array('system_info', 'installed_plugins'), 'extra' => array('style' => 'display: none;'), 'desc' => $this->get_installed_plugins())));
     $this->tab_sections['cron']['info'] = array('title' => __('Cron Jobs', APP_TD), 'fields' => $this->cronjob_fields(), 'renderer' => array($this, 'render_cronjob_fields'));
 }
コード例 #23
0
ファイル: ajax.php プロジェクト: fritzdenim/pangMoves
function userpro_video_upload_size()
{
    $options = get_option('userpro_media');
    if ($options['media_video_size_limit'] <= wp_max_upload_size() / (1024 * 1024)) {
        $max_file_size = $options['media_video_size_limit'];
    } else {
        $max_file_size = wp_max_upload_size() / (1024 * 1024);
    }
    ?>
		<script type="text/javascript">
		var userpro_video_upload_size = '<?php 
    echo $max_file_size . "MB";
    ?>
';
		</script>
	<?php 
}
コード例 #24
0
ファイル: meta-generator.php プロジェクト: pryspry/MusicPlay
        function plupload_admin_head()
        {
            global $post, $wpdb;
            if (!$post) {
                return;
            }
            $post_id = $post->ID;
            // place js config array for plupload
            $plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => wp_max_upload_size(), 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'multipart' => true, 'urlstream_upload' => true, 'multipart_params' => array('_ajax_nonce' => "", 'action' => 'plupload_action', 'post_id' => $post_id));
            ?>
			<script type="text/javascript">
				var base_plupload_config=<?php 
            echo json_encode($plupload_init);
            ?>
;
			</script>
			<?php 
        }
コード例 #25
0
 function ds_get_server_details($args)
 {
     // Check user credentials
     if (!$this->authenticate(array_shift($args), array_shift($args))) {
         return $this->auth_error;
     }
     // Return server details needed for DesktopServer deployment
     $wp_constants = array('DB_NAME', 'DB_USER', 'DB_PASSWORD', 'DB_HOST');
     $server_details = array();
     foreach ($wp_constants as $constant) {
         $value = '';
         if (defined($constant)) {
             $value = constant($constant);
         }
         $server_details[$constant] = $value;
     }
     global $wp_version;
     $server_details['DOCUMENT_ROOT'] = $this->doc_root;
     $pdata = get_plugin_data(__FILE__);
     $server_details['DS_VERSION'] = $pdata['Version'];
     $server_details['WP_VERSION'] = $wp_version;
     $server_details['MAX_UPLOAD'] = wp_max_upload_size();
     // Test for compatible WP_Filesystem availability
     $fsm = '';
     WP_Filesystem();
     global $wp_filesystem;
     if (defined('FS_METHOD')) {
         $fsm = constant('FS_METHOD');
     } else {
         if (isset($wp_filesystem)) {
             if (isset($wp_filesystem->method)) {
                 $fsm = $wp_filesystem->method;
             }
         }
     }
     $server_details['FS_METHOD'] = $fsm;
     // Save details to session for db_runnner.php
     if (!session_id()) {
         session_start();
     }
     $server_details['session_id'] = session_id();
     $_SESSION['server_details'] = $server_details;
     return $server_details;
 }
コード例 #26
0
 function print_script()
 {
     if (!$this->add_sc_script) {
         return;
     }
     $params = array('url' => 'upload', 'runtimes' => 'gears,html5,flash,browserplus,html4', 'browse_button' => 'browse-button', 'container' => 'bpm-file_upload-ui', 'drop_element' => 'drag-drop-area', 'filters' => apply_filters('bp_media_plupload_files_filter', array(array('title' => "Media Files", 'extensions' => get_rtmedia_allowed_upload_type()))), 'max_file_size' => wp_max_upload_size() / (1024 * 1024) . 'M', 'multipart' => true, 'urlstream_upload' => true, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'file_data_name' => 'bp_media_file', 'multi_selection' => true, 'multipart_params' => apply_filters('bp_media_multipart_params_filter', array('action' => 'wp_handle_upload')));
     foreach ((array) $params as $key => $value) {
         if (!is_scalar($value)) {
             continue;
         }
         $params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
     }
     echo "<script type='text/javascript'>\n";
     // CDATA and type='text/javascript' is not needed for HTML 5
     echo "/* <![CDATA[ */\n";
     echo "var bpm_plupload_params = " . json_encode($params) . ";\n";
     echo "/* ]]> */\n";
     echo "</script>\n";
     wp_print_scripts('bpm-plupload');
 }
コード例 #27
0
function so_panels_bootstrap_admin_enqueue_scripts($prefix = '', $force = false)
{
    $screen = get_current_screen();
    if ($force || siteorigin_panels_is_admin_page()) {
        wp_enqueue_media();
        //wp_enqueue_script( 'so-panels-bootstrap-admin', plugin_dir_url(__FILE__) . 'assets/js/so-panels-bootstrap' . SITEORIGIN_PANELS_JS_SUFFIX . '.js', array( 'jquery', 'jquery-ui-resizable', 'jquery-ui-sortable', 'jquery-ui-draggable', 'underscore', 'backbone', 'plupload', 'plupload-all' ), SITEORIGIN_PANELS_VERSION, true );
        wp_enqueue_script('so-panels-bootstrap-admin', plugin_dir_url(__FILE__) . 'assets/js/so-panels-bootstrap.js', array('jquery', 'jquery-ui-resizable', 'jquery-ui-sortable', 'jquery-ui-draggable', 'underscore', 'backbone', 'plupload', 'plupload-all'), SITEORIGIN_PANELS_VERSION, true);
        wp_enqueue_script('so-panels-bootstrap-admin-utils', plugin_dir_url(__FILE__) . 'assets/js/so-panels-bootstrap-utils' . SITEORIGIN_PANELS_JS_SUFFIX . '.js', null, SITEORIGIN_PANELS_VERSION, true);
        wp_enqueue_script('so-panels-bootstrap-admin-utils', plugin_dir_url(__FILE__) . 'assets/js/so-panels-bootstrap-utils' . SITEORIGIN_PANELS_JS_SUFFIX . '.js', null, SITEORIGIN_PANELS_VERSION, true);
        wp_enqueue_script('so-panels-bootstrap-admin-styles', plugin_dir_url(__FILE__) . 'assets/js/so-panels-bootstrap-styles' . SITEORIGIN_PANELS_JS_SUFFIX . '.js', array('jquery', 'underscore', 'backbone', 'wp-color-picker'), SITEORIGIN_PANELS_VERSION, true);
        if ($screen->base != 'widgets' && $screen->base != 'customize') {
            // We don't use the history browser and live editor in the widgets interface
            wp_enqueue_script('so-panels-bootstrap-admin-history', plugin_dir_url(__FILE__) . 'assets/js/so-panels-bootstrap-history' . SITEORIGIN_PANELS_JS_SUFFIX . '.js', array('so-panels-bootstrap-admin', 'jquery', 'underscore', 'backbone'), SITEORIGIN_PANELS_VERSION, true);
            wp_enqueue_script('so-panels-bootstrap-admin-live-editor', plugin_dir_url(__FILE__) . 'assets/js/so-panels-bootstrap-admin-live-editor' . SITEORIGIN_PANELS_JS_SUFFIX . '.js', array('so-panels-bootstrap-admin', 'jquery', 'underscore', 'backbone'), SITEORIGIN_PANELS_VERSION, true);
        }
        add_action('admin_footer', 'siteorigin_panels_js_templates');
        $widgets = siteorigin_panels_get_widgets();
        $directory_enabled = get_user_meta(get_current_user_id(), 'so_panels_directory_enabled', true);
        wp_localize_script('so-panels-bootstrap-admin', 'soPanelsOptions', array('ajaxurl' => wp_nonce_url(admin_url('admin-ajax.php'), 'panels_action', '_panelsnonce'), 'widgets' => $widgets, 'widget_dialog_tabs' => apply_filters('siteorigin_panels_widget_dialog_tabs', array(0 => array('title' => __('All Widgets', 'siteorigin-panels'), 'filter' => array('installed' => true, 'groups' => '')))), 'row_layouts' => apply_filters('siteorigin_panels_row_layouts', array()), 'directory_enabled' => !empty($directory_enabled), 'contextual' => array('default_widgets' => apply_filters('siteorigin_panels_contextual_default_widgets', array('SiteOrigin_Widget_Editor_Widget', 'SiteOrigin_Widget_Button_Widget', 'SiteOrigin_Widget_Image_Widget', 'SiteOrigin_Panels_Widgets_Layout'))), 'loc' => array('missing_widget' => array('title' => __('Missing Widget', 'siteorigin-panels'), 'description' => __("Page Builder doesn't know about this widget.", 'siteorigin-panels')), 'time' => array('seconds' => __('%d seconds', 'siteorigin-panels'), 'minutes' => __('%d minutes', 'siteorigin-panels'), 'hours' => __('%d hours', 'siteorigin-panels'), 'second' => __('%d second', 'siteorigin-panels'), 'minute' => __('%d minute', 'siteorigin-panels'), 'hour' => __('%d hour', 'siteorigin-panels'), 'ago' => __('%s before', 'siteorigin-panels'), 'now' => __('Now', 'siteorigin-panels')), 'history' => array('current' => __('Current', 'siteorigin-panels'), 'revert' => __('Original', 'siteorigin-panels'), 'restore' => __('Version restored', 'siteorigin-panels'), 'back_to_editor' => __('Converted to editor', 'siteorigin-panels'), 'widget_deleted' => __('Widget deleted', 'siteorigin-panels'), 'widget_added' => __('Widget added', 'siteorigin-panels'), 'widget_edited' => __('Widget edited', 'siteorigin-panels'), 'widget_duplicated' => __('Widget duplicated', 'siteorigin-panels'), 'widget_moved' => __('Widget moved', 'siteorigin-panels'), 'row_deleted' => __('Row deleted', 'siteorigin-panels'), 'row_added' => __('Row added', 'siteorigin-panels'), 'row_edited' => __('Row edited', 'siteorigin-panels'), 'row_moved' => __('Row moved', 'siteorigin-panels'), 'row_duplicated' => __('Row duplicated', 'siteorigin-panels'), 'cell_resized' => __('Cell resized', 'siteorigin-panels'), 'prebuilt_loaded' => __('Prebuilt layout loaded', 'siteorigin-panels')), 'prebuilt_confirm' => __('Are you sure you want to overwrite your current content? This can be undone in the builder history.', 'siteorigin-panels'), 'prebuilt_loading' => __('Loading prebuilt layout', 'siteorigin-panels'), 'confirm_use_builder' => __("Would you like to copy this editor's existing content to Page Builder?", 'siteorigin-panels'), 'confirm_stop_builder' => __("Would you like to clear your Page Builder content and revert to using the standard visual editor?", 'siteorigin-panels'), 'layout_widget' => __('Layout Builder Widget', 'siteorigin-panels'), 'dropdown_confirm' => __('Are you sure?', 'siteorigin-panels'), 'search_results_header' => __('Search Results For: ', 'siteorigin-panels'), 'contextual' => array('add_widget_below' => __('Add Widget Below', 'siteorigin-panels'), 'add_widget_cell' => __('Add Widget to Cell', 'siteorigin-panels'), 'search_widgets' => __('Search Widgets', 'siteorigin-panels'), 'add_row' => __('Add Row', 'siteorigin-panels'), 'column' => __('Column', 'siteorigin-panels'))), 'plupload' => array('max_file_size' => wp_max_upload_size() . 'b', 'url' => wp_nonce_url(admin_url('admin-ajax.php'), 'panels_action', '_panelsnonce'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filter_title' => __('Page Builder layouts', 'siteorigin-panels'), 'error_message' => __('Error uploading or importing file.', 'siteorigin-panels')), 'wpColorPickerOptions' => apply_filters('siteorigin_panels_wpcolorpicker_options', array())));
    }
}
コード例 #28
0
/**
 * Get the BuddyPress Plupload settings.
 *
 * @since  2.3.0
 *
 * @return array list of BuddyPress Plupload settings.
 */
function bp_attachments_get_plupload_default_settings()
{
    $max_upload_size = wp_max_upload_size();
    if (!$max_upload_size) {
        $max_upload_size = 0;
    }
    $defaults = array('runtimes' => 'html5,flash,silverlight,html4', 'file_data_name' => 'file', 'multipart_params' => array('action' => 'bp_upload_attachment', '_wpnonce' => wp_create_nonce('bp-uploader')), 'url' => admin_url('admin-ajax.php', 'relative'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array('max_file_size' => $max_upload_size . 'b'), 'multipart' => true, 'urlstream_upload' => true);
    // WordPress is not allowing multi selection for iOs 7 device.. See #29602.
    if (wp_is_mobile() && strpos($_SERVER['HTTP_USER_AGENT'], 'OS 7_') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'like Mac OS X') !== false) {
        $defaults['multi_selection'] = false;
    }
    $settings = array('defaults' => $defaults, 'browser' => array('mobile' => wp_is_mobile(), 'supported' => _device_can_upload()), 'limitExceeded' => is_multisite() && !is_upload_space_available());
    /**
     * Filter the BuddyPress Plupload default settings.
     *
     * @since 2.3.0
     *
     * @param array $params Default Plupload parameters array.
     */
    return apply_filters('bp_attachments_get_plupload_default_settings', $settings);
}
コード例 #29
0
 static function register_scripts()
 {
     if (!wp_script_is('plupload-all')) {
         wp_enqueue_script('plupload-all');
     }
     wp_enqueue_script('rtmedia-backbone', RTMEDIA_URL . 'app/assets/js/rtMedia.backbone.js', array('plupload-all', 'backbone'), RTMEDIA_VERSION, true);
     if (is_rtmedia_album_gallery()) {
         $template_url = esc_url(add_query_arg(array('action' => 'rtmedia_get_template', 'template' => 'album-gallery-item'), admin_url('admin-ajax.php')), null, '');
     } else {
         $template_url = esc_url(add_query_arg(array('action' => 'rtmedia_get_template', 'template' => apply_filters('rtmedia_backbone_template_filter', 'media-gallery-item')), admin_url('admin-ajax.php')), null, '');
     }
     wp_localize_script('rtmedia-backbone', 'template_url', $template_url);
     $request_uri = rtm_get_server_var('REQUEST_URI', 'FILTER_SANITIZE_URL');
     $url = trailingslashit($request_uri);
     $rtmedia_slug = '/' . RTMEDIA_MEDIA_SLUG;
     // check position of media slug from end of the URL
     if (strrpos($url, $rtmedia_slug) !== false) {
         // split the url upto the last occurance of media slug
         $url_upload = substr($url, 0, strrpos($url, $rtmedia_slug));
         $url = trailingslashit($url_upload) . 'upload/';
     } else {
         $url = trailingslashit($url) . 'upload/';
     }
     $params = array('url' => $url, 'runtimes' => 'html5,flash,html4', 'browse_button' => apply_filters('rtmedia_upload_button_id', 'rtMedia-upload-button'), 'container' => 'rtmedia-upload-container', 'drop_element' => 'drag-drop-area', 'filters' => apply_filters('rtmedia_plupload_files_filter', array(array('title' => 'Media Files', 'extensions' => get_rtmedia_allowed_upload_type()))), 'max_file_size' => wp_max_upload_size() / (1024 * 1024) . 'M', 'multipart' => true, 'urlstream_upload' => true, 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'file_data_name' => 'rtmedia_file', 'multi_selection' => true, 'multipart_params' => apply_filters('rtmedia-multi-params', array('redirect' => 'no', 'action' => 'wp_handle_upload', '_wp_http_referer' => $request_uri, 'mode' => 'file_upload', 'rtmedia_upload_nonce' => RTMediaUploadView::upload_nonce_generator(false, true))), 'max_file_size_msg' => apply_filters('rtmedia_plupload_file_size_msg', min(array(ini_get('upload_max_filesize'), ini_get('post_max_size')))));
     if (wp_is_mobile()) {
         $params['multi_selection'] = false;
     }
     $params = apply_filters('rtmedia_modify_upload_params', $params);
     global $rtmedia;
     $rtmedia_extns = array();
     foreach ($rtmedia->allowed_types as $allowed_types_key => $allowed_types_value) {
         $rtmedia_extns[$allowed_types_key] = $allowed_types_value['extn'];
     }
     wp_localize_script('rtmedia-backbone', 'rtmedia_exteansions', $rtmedia_extns);
     wp_localize_script('rtmedia-backbone', 'rtMedia_plupload_config', $params);
     wp_localize_script('rtmedia-backbone', 'rMedia_loading_file', admin_url('/images/loading.gif'));
 }
コード例 #30
0
ファイル: defaults.php プロジェクト: fritzdenim/pangMoves
function userpro_media_default_options()
{
    $array = array();
    $array['media_comments'] = 'n';
    $array['media_view'] = 'n';
    $array['media_display'] = 'n';
    $array['media_per_page'] = 10;
    $array['media_photo_type'] = 'y';
    $array['media_video_type'] = 'y';
    $array['media_music_type'] = 'y';
    $array['media_photo_extension_list'] = 'jpg,jpeg,png,gif';
    $array['media_video_extension_list'] = 'mp4,avi,mpg,flv';
    $array['media_music_extension_list'] = 'mp3,wav';
    $array['media_photo_size_limit'] = round(wp_max_upload_size() / (1024 * 1024), 2, PHP_ROUND_HALF_DOWN);
    $array['media_video_size_limit'] = round(wp_max_upload_size() / (1024 * 1024), 2, PHP_ROUND_HALF_DOWN);
    $array['media_music_size_limit'] = round(wp_max_upload_size() / (1024 * 1024), 2, PHP_ROUND_HALF_DOWN);
    $array['media_photo_number_limit'] = '-1';
    $array['media_video_number_limit'] = '-1';
    $array['media_music_number_limit'] = '-1';
    $array['media_photo_upload_count'] = 'n';
    $array['media_video_upload_count'] = 'n';
    $array['media_music_upload_count'] = 'n';
    return apply_filters('userpro_media_default_options_array', $array);
}