function scripts()
 {
     $max_file_size = intval(auiu_get_option('attachment_max_size', 'auiu_frontend_posting')) * 1024;
     $max_upload = intval(auiu_get_option('attachment_num', 'auiu_frontend_posting'));
     $attachment_enabled = auiu_get_option('allow_attachment', 'auiu_frontend_posting');
     wp_enqueue_script('jquery');
     if (auiu_has_shortcode('afb_uploadform') || auiu_has_shortcode('auiu_edit')) {
         wp_enqueue_script('plupload-handlers');
     }
     wp_enqueue_script('jquery-ui-sortable');
     wp_enqueue_script('auiu_attachment', plugins_url('js/attachment.js', dirname(__FILE__)), array('jquery'));
     wp_localize_script('auiu_attachment', 'auiu_attachment', array('nonce' => wp_create_nonce('auiu_attachment'), 'number' => $max_upload, 'attachment_enabled' => $attachment_enabled == 'yes' ? true : false, 'plupload' => array('runtimes' => 'html5,flash,html4', 'browse_button' => 'auiu-attachment-upload-pickfiles', 'container' => 'auiu-attachment-upload-container', 'file_data_name' => 'auiu_attachment_file', 'max_file_size' => $max_file_size . 'b', 'url' => admin_url('admin-ajax.php') . '?action=auiu_attach_upload&nonce=' . wp_create_nonce('auiu_audio_track'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true)));
 }
Exemplo n.º 2
0
 /**
  * Enqueues Styles and Scripts when the shortcodes are used only
  *
  * @uses has_shortcode()
  * @since 0.2
  */
 function enqueue_scripts()
 {
     $path = plugins_url('', __FILE__);
     //for multisite upload limit filter
     if (is_multisite()) {
         require_once ABSPATH . '/wp-admin/includes/ms.php';
     }
     require_once ABSPATH . '/wp-admin/includes/template.php';
     wp_enqueue_style('auiu', $path . '/css/auiu.css');
     if (auiu_has_shortcode('afb_uploadform')) {
         wp_enqueue_script('plupload-handlers');
     }
     wp_enqueue_script('auiu', $path . '/js/auiu.js', array('jquery'));
     wp_enqueue_script('recaptcha', 'https://www.google.com/recaptcha/api.js');
     $posting_msg = auiu_get_option('updating_label', 'auiu_labels');
     $feat_img_enabled = auiu_get_option('enable_featured_image', 'auiu_frontend_posting') == 'yes' ? true : false;
     $size_limit = (int) auiu_get_option('attachment_max_size', 'auiu_frontend_posting');
     wp_localize_script('auiu', 'auiu', array('ajaxurl' => admin_url('admin-ajax.php'), 'postingMsg' => $posting_msg, 'confirmMsg' => __('Are you sure?', 'auiu'), 'nonce' => wp_create_nonce('auiu_nonce'), 'featEnabled' => $feat_img_enabled, 'plupload' => array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'auiu-ft-upload-pickfiles', 'drop_element' => 'auiu-ft-upload-container', 'container' => 'auiu-ft-upload-container', 'file_data_name' => 'auiu_featured_img', 'max_file_size' => $size_limit . 'kb', 'url' => admin_url('admin-ajax.php') . '?action=auiu_featured_img&nonce=' . wp_create_nonce('auiu_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)));
 }