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


PHP acf_enqueue_uploader函数代码示例

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


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

示例1: acf_scripts

 /**
  * Enqueues ACF uploader scripts
  * @param  mixed $options either false or json encoded options
  */
 public function acf_scripts($options)
 {
     if (function_exists('acf_enqueue_uploader')) {
         acf_enqueue_uploader();
         wp_enqueue_script('wa-fronted-acf-scripts', plugins_url('/acf.min.js', __FILE__), array('wa-fronted-scripts'), '0.1', true);
     }
 }
开发者ID:Aftonbladet,项目名称:wa-fronted,代码行数:11,代码来源:acf.php

示例2: render_field

        function render_field($field)
        {
            // enqueue
            acf_enqueue_uploader();
            // vars
            $div_atts = array('class' => 'acf-image-uploader acf-cf', 'data-preview_size' => $field['preview_size'], 'data-library' => $field['library']);
            $input_atts = array('type' => 'hidden', 'name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id');
            $url = '';
            // has value?
            if ($field['value'] && is_numeric($field['value'])) {
                $url = wp_get_attachment_image_src($field['value'], $field['preview_size']);
                $url = $url[0];
                $div_atts['class'] .= ' has-value';
            }
            ?>
<div <?php 
            acf_esc_attr_e($div_atts);
            ?>
>
	<div class="acf-hidden">
		<input <?php 
            acf_esc_attr_e($input_atts);
            ?>
/>
	</div>
	<div class="view show-if-value acf-soh">
		<ul class="acf-hl acf-soh-target">
			<li><a class="acf-icon dark" data-name="edit" href="#"><i class="acf-sprite-edit"></i></a></li>
			<li><a class="acf-icon dark" data-name="remove" href="#"><i class="acf-sprite-delete"></i></a></li>
		</ul>
		<img data-name="image" src="<?php 
            echo $url;
            ?>
" alt=""/>
	</div>
	<div class="view hide-if-value">
		<p><?php 
            _e('No image selected', 'acf');
            ?>
 <a data-name="add" class="acf-button" href="#"><?php 
            _e('Add Image', 'acf');
            ?>
</a></p>
	</div>
</div>
<?php 
        }
开发者ID:FR073N,项目名称:itescia,代码行数:47,代码来源:image.php

示例3: render_field

        function render_field($field)
        {
            // vars
            $uploader = acf_get_setting('uploader');
            // enqueue
            if ($uploader == 'wp') {
                acf_enqueue_uploader();
            }
            // vars
            $url = '';
            $div = array('class' => 'acf-image-uploader acf-cf', 'data-preview_size' => $field['preview_size'], 'data-library' => $field['library'], 'data-mime_types' => $field['mime_types'], 'data-uploader' => $uploader);
            // has value?
            if ($field['value'] && is_numeric($field['value'])) {
                $url = wp_get_attachment_image_src($field['value'], $field['preview_size']);
                if ($url) {
                    $url = $url[0];
                    $div['class'] .= ' has-value';
                }
            }
            ?>
<div <?php 
            acf_esc_attr_e($div);
            ?>
>
	<div class="acf-hidden">
		<?php 
            acf_hidden_input(array('name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id'));
            ?>
	</div>
	<div class="view show-if-value acf-soh">
		<img data-name="image" src="<?php 
            echo $url;
            ?>
" alt=""/>
		<ul class="acf-hl acf-soh-target">
			<?php 
            if ($uploader != 'basic') {
                ?>
				<li><a class="acf-icon acf-icon-pencil dark" data-name="edit" href="#"></a></li>
			<?php 
            }
            ?>
			<li><a class="acf-icon acf-icon-cancel dark" data-name="remove" href="#"></a></li>
		</ul>
	</div>
	<div class="view hide-if-value">
		<?php 
            if ($uploader == 'basic') {
                ?>
			
			<?php 
                if ($field['value'] && !is_numeric($field['value'])) {
                    ?>
				<div class="acf-error-message"><p><?php 
                    echo $field['value'];
                    ?>
</p></div>
			<?php 
                }
                ?>
			
			<input type="file" name="<?php 
                echo $field['name'];
                ?>
" id="<?php 
                echo $field['id'];
                ?>
" />
			
		<?php 
            } else {
                ?>
			
			<p style="margin:0;"><?php 
                _e('No image selected', 'acf');
                ?>
 <a data-name="add" class="acf-button" href="#"><?php 
                _e('Add Image', 'acf');
                ?>
</a></p>
			
		<?php 
            }
            ?>
	</div>
</div>
<?php 
        }
开发者ID:slavic18,项目名称:cats,代码行数:88,代码来源:image.php

示例4: render_field

        function render_field($field)
        {
            // enqueue
            acf_enqueue_uploader();
            // vars
            $atts = array('id' => $field['id'], 'class' => "acf-gallery {$field['class']}", 'data-library' => $field['library'], 'data-min' => $field['min'], 'data-max' => $field['max'], 'data-mime_types' => $field['mime_types'], 'data-insert' => $field['insert'], 'data-columns' => 4);
            // set gallery height
            $height = acf_get_user_setting('gallery_height', 400);
            $height = max($height, 200);
            // minimum height is 200
            $atts['style'] = "height:{$height}px";
            // get posts
            $value = $this->get_attachments($field['value']);
            ?>
<div <?php 
            acf_esc_attr_e($atts);
            ?>
>
	
	<div class="acf-hidden">
		<?php 
            acf_hidden_input(array('name' => $field['name'], 'value' => ''));
            ?>
	</div>
	
	<div class="acf-gallery-main">
		
		<div class="acf-gallery-attachments">
			
			<?php 
            if ($value) {
                ?>
			
				<?php 
                foreach ($value as $i => $v) {
                    // bail early if no value
                    if (!$v) {
                        continue;
                    }
                    // vars
                    $a = array('ID' => $v->ID, 'title' => $v->post_title, 'filename' => wp_basename($v->guid), 'type' => acf_maybe_get(explode('/', $v->post_mime_type), 0), 'class' => 'acf-gallery-attachment acf-soh');
                    // thumbnail
                    $thumbnail = acf_get_post_thumbnail($a['ID'], 'medium');
                    // remove filename if is image
                    if ($a['type'] == 'image') {
                        $a['filename'] = '';
                    }
                    // class
                    $a['class'] .= ' -' . $a['type'];
                    if ($thumbnail['type'] == 'icon') {
                        $a['class'] .= ' -icon';
                    }
                    ?>
					<div class="<?php 
                    echo $a['class'];
                    ?>
" data-id="<?php 
                    echo $a['ID'];
                    ?>
">
						<?php 
                    acf_hidden_input(array('name' => $field['name'] . '[]', 'value' => $a['ID']));
                    ?>
						<div class="margin">
							<div class="thumbnail">
								<img src="<?php 
                    echo $thumbnail['url'];
                    ?>
" alt="" title="<?php 
                    echo $a['title'];
                    ?>
"/>
							</div>
							<?php 
                    if ($a['filename']) {
                        ?>
							<div class="filename"><?php 
                        echo acf_get_truncated($a['filename'], 30);
                        ?>
</div>	
							<?php 
                    }
                    ?>
						</div>
						<div class="actions acf-soh-target">
							<a class="acf-icon -cancel dark acf-gallery-remove" href="#" data-id="<?php 
                    echo $a['ID'];
                    ?>
" title="<?php 
                    _e('Remove', 'acf');
                    ?>
"></a>
						</div>
					</div>
				<?php 
                }
                ?>
				
			<?php 
            }
//.........这里部分代码省略.........
开发者ID:rmikeska,项目名称:ushipnetwork,代码行数:101,代码来源:gallery.php

示例5: render_field

        function render_field($field)
        {
            // global
            global $wp_version;
            // enqueue
            acf_enqueue_uploader();
            // vars
            $id = uniqid('acf-editor-');
            $default_editor = 'html';
            $show_tabs = true;
            $button = '';
            // get height
            $height = acf_get_user_setting('wysiwyg_height', 300);
            $height = max($height, 300);
            // minimum height is 300
            // detect mode
            if (!user_can_richedit()) {
                $show_tabs = false;
            } elseif ($field['tabs'] == 'visual') {
                // case: visual tab only
                $default_editor = 'tinymce';
                $show_tabs = false;
            } elseif ($field['tabs'] == 'text') {
                // case: text tab only
                $show_tabs = false;
            } elseif (wp_default_editor() == 'tinymce') {
                // case: both tabs
                $default_editor = 'tinymce';
            }
            // must be logged in tp upload
            if (!current_user_can('upload_files')) {
                $field['media_upload'] = 0;
            }
            // mode
            $switch_class = $default_editor === 'html' ? 'html-active' : 'tmce-active';
            // filter value for editor
            remove_filter('acf_the_editor_content', 'format_for_editor', 10, 2);
            remove_filter('acf_the_editor_content', 'wp_htmledit_pre', 10, 1);
            remove_filter('acf_the_editor_content', 'wp_richedit_pre', 10, 1);
            // WP 4.3
            if (version_compare($wp_version, '4.3', '>=')) {
                add_filter('acf_the_editor_content', 'format_for_editor', 10, 2);
                $button = 'data-wp-editor-id="' . $id . '"';
                // WP < 4.3
            } else {
                $function = $default_editor === 'html' ? 'wp_htmledit_pre' : 'wp_richedit_pre';
                add_filter('acf_the_editor_content', $function, 10, 1);
                $button = 'onclick="switchEditors.switchto(this);"';
            }
            // filter
            $field['value'] = apply_filters('acf_the_editor_content', $field['value'], $default_editor);
            ?>
		<div id="wp-<?php 
            echo $id;
            ?>
-wrap" class="acf-editor-wrap wp-core-ui wp-editor-wrap <?php 
            echo $switch_class;
            ?>
" data-toolbar="<?php 
            echo $field['toolbar'];
            ?>
" data-upload="<?php 
            echo $field['media_upload'];
            ?>
">
			<div id="wp-<?php 
            echo $id;
            ?>
-editor-tools" class="wp-editor-tools hide-if-no-js">
				<?php 
            if ($field['media_upload']) {
                ?>
				<div id="wp-<?php 
                echo $id;
                ?>
-media-buttons" class="wp-media-buttons">
					<?php 
                do_action('media_buttons', $id);
                ?>
				</div>
				<?php 
            }
            ?>
				<?php 
            if (user_can_richedit() && $show_tabs) {
                ?>
					<div class="wp-editor-tabs">
						<button id="<?php 
                echo $id;
                ?>
-tmce" class="wp-switch-editor switch-tmce" <?php 
                echo $button;
                ?>
 type="button"><?php 
                echo __('Visual', 'acf');
                ?>
</button>
						<button id="<?php 
                echo $id;
                ?>
//.........这里部分代码省略.........
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:101,代码来源:wysiwyg.php

示例6: render_field

    function render_field($field)
    {
        // enqueue
        acf_enqueue_uploader();
        // get data from value
        //$data = json_decode($field['value']);
        $imageData = $this->get_image_data($field);
        $url = '';
        $orignialImage = null;
        if ($imageData->original_image) {
            $originalImage = wp_get_attachment_image_src($imageData->original_image, 'full');
            $url = $imageData->preview_image_url;
        }
        $width = 0;
        $height = 0;
        if ($field['target_size'] == 'custom') {
            $width = $field['width'];
            $height = $field['height'];
        } else {
            global $_wp_additional_image_sizes;
            $s = $field['target_size'];
            if (isset($_wp_additional_image_sizes[$s])) {
                $width = intval($_wp_additional_image_sizes[$s]['width']);
                $height = intval($_wp_additional_image_sizes[$s]['height']);
            } else {
                $width = get_option($s . '_size_w');
                $height = get_option($s . '_size_h');
            }
        }
        // Retina mode
        if ($this->getOption('retina_mode') || $field['retina_mode'] == 'yes') {
            $width = $width * 2;
            $height = $height * 2;
        }
        // vars
        $div_atts = array('class' => 'acf-image-uploader acf-cf acf-image-crop', 'data-crop_type' => $field['crop_type'], 'data-target_size' => $field['target_size'], 'data-width' => $width, 'data-height' => $height, 'data-force_crop' => $field['force_crop'] == 'yes' ? 'true' : 'false', 'data-save_to_media_library' => $field['save_in_media_library'], 'data-save_format' => $field['save_format'], 'data-preview_size' => $field['preview_size'], 'data-library' => $field['library']);
        $input_atts = array('type' => 'hidden', 'name' => $field['name'], 'value' => htmlspecialchars($field['value']), 'data-name' => 'id', 'data-original-image' => $imageData->original_image, 'data-cropped-image' => json_encode($imageData->cropped_image), 'class' => 'acf-image-value');
        // has value?
        if ($imageData->original_image) {
            $url = $imageData->preview_image_url;
            $div_atts['class'] .= ' has-value';
        }
        ?>
<div <?php 
        acf_esc_attr_e($div_atts);
        ?>
>
    <div class="acf-hidden">
        <input <?php 
        acf_esc_attr_e($input_atts);
        ?>
/>
    </div>
    <div class="view show-if-value acf-soh">
        <ul class="acf-hl acf-soh-target">
            <li><a class="acf-icon dark" data-name="edit" href="#"><i class="acf-sprite-edit"></i></a></li>
            <li><a class="acf-icon dark" data-name="remove" href="#"><i class="acf-sprite-delete"></i></a></li>
        </ul>
        <img data-name="image" src="<?php 
        echo $url;
        ?>
" alt=""/>
        <div class="crop-section">
            <div class="crop-stage">
                <div class="crop-action">
                    <h4><?php 
        _e('Crop the image', 'acf-image_crop');
        ?>
</h4>
                <?php 
        if ($imageData->original_image) {
            ?>
                    <img class="crop-image" src="<?php 
            echo $imageData->original_image_url;
            ?>
" data-width="<?php 
            echo $imageData->original_image_width;
            ?>
" data-height="<?php 
            echo $imageData->original_image_height;
            ?>
" alt="">
                <?php 
        }
        ?>
                </div>
                <div class="crop-preview">
                    <h4><?php 
        _e('Preview', 'acf-image_crop');
        ?>
</h4>
                    <div class="preview"></div>
                    <div class="crop-controls">
                        <a href="#" class="button button-large cancel-crop-button"><?php 
        _e('Cancel', 'acf-image_crop');
        ?>
</a> <a href="#" class="button button-large button-primary perform-crop-button"><?php 
        _e('Crop!', 'acf-image_crop');
        ?>
</a>
//.........这里部分代码省略.........
开发者ID:jenniwhite6,项目名称:My-Blog,代码行数:101,代码来源:acf-image-crop-v5.php

示例7: render_field

    function render_field($field)
    {
        global $q_config;
        $languages = qtrans_getSortedLanguages(true);
        $values = qtrans_split($field['value'], $quicktags = true);
        $currentLanguage = $this->plugin->get_active_language();
        // enqueue
        acf_enqueue_uploader();
        // vars
        $o = array('icon' => '', 'title' => '', 'size' => '', 'url' => '', 'name' => '');
        $div = array('class' => 'acf-file-uploader acf-cf', 'data-library' => $field['library'], 'data-mime_types' => $field['mime_types']);
        $input_atts = array('type' => 'hidden', 'name' => $field['name'], 'value' => $field['value'], 'data-name' => 'value-id');
        $url = '';
        echo '<div class="multi-language-field multi-language-field-image">';
        foreach ($languages as $language) {
            $class = 'wp-switch-editor';
            if ($language === $currentLanguage) {
                $class .= ' current-language';
            }
            echo '<a class="' . $class . '" data-language="' . $language . '">' . $q_config['language_name'][$language] . '</a>';
        }
        foreach ($languages as $language) {
            $input_atts['name'] = $field['name'] . '[' . $language . ']';
            $field['value'] = $values[$language];
            $div['data-language'] = $language;
            $div['class'] = 'acf-file-uploader acf-cf';
            // has value?
            if ($field['value'] && is_numeric($field['value'])) {
                $file = get_post($field['value']);
                if ($file) {
                    $div['class'] .= ' has-value';
                    $o['icon'] = wp_mime_type_icon($file->ID);
                    $o['title'] = $file->post_title;
                    $o['size'] = @size_format(filesize(get_attached_file($file->ID)));
                    $o['url'] = wp_get_attachment_url($file->ID);
                    $explode = explode('/', $o['url']);
                    $o['name'] = end($explode);
                }
            }
            // basic?
            $basic = !current_user_can('upload_files');
            if ($basic) {
                $div['class'] .= ' basic';
            }
            if ($language === $currentLanguage) {
                $div['class'] .= ' current-language';
            }
            ?>
			<div <?php 
            acf_esc_attr_e($div);
            ?>
>
				<div class="acf-hidden">
					<?php 
            acf_hidden_input(array('name' => $input_atts['name'], 'value' => $field['value'], 'data-name' => 'id'));
            ?>
				</div>
				<div class="show-if-value file-wrap acf-soh">
					<div class="file-icon">
						<img data-name="icon" src="<?php 
            echo $o['icon'];
            ?>
" alt=""/>
					</div>
					<div class="file-info">
						<p>
							<strong data-name="title"><?php 
            echo $o['title'];
            ?>
</strong>
						</p>
						<p>
							<strong><?php 
            _e('File Name', 'acf');
            ?>
:</strong>
							<a data-name="name" href="<?php 
            echo $o['url'];
            ?>
" target="_blank"><?php 
            echo $o['name'];
            ?>
</a>
						</p>
						<p>
							<strong><?php 
            _e('File Size', 'acf');
            ?>
:</strong>
							<span data-name="size"><?php 
            echo $o['size'];
            ?>
</span>
						</p>

						<ul class="acf-hl acf-soh-target">
							<?php 
            if (!$basic) {
                ?>
								<li><a class="acf-icon dark" data-name="edit" href="#"><i class="acf-sprite-edit"></i></a></li>
//.........这里部分代码省略.........
开发者ID:Tusko,项目名称:acf-qtranslate,代码行数:101,代码来源:file.php

示例8: render_field

        function render_field($field)
        {
            // enqueue
            acf_enqueue_uploader();
            // vars
            $id = $field['id'] . '-' . uniqid();
            $mode = 'html';
            $show_tabs = true;
            // get height
            $height = acf_get_user_setting('wysiwyg_height', 300);
            $height = max($height, 300);
            // minimum height is 300
            // detect mode
            if ($field['tabs'] == 'visual') {
                // case: visual tab only
                $mode = 'tmce';
                $show_tabs = false;
            } elseif ($field['tabs'] == 'text') {
                // case: text tab only
                $show_tabs = false;
            } elseif (wp_default_editor() == 'tinymce') {
                // case: both tabs
                $mode = 'tmce';
            }
            // mode
            $switch_class = $mode . '-active';
            // filter value for editor
            remove_all_filters('acf_the_editor_content');
            if ($mode == 'tmce') {
                add_filter('acf_the_editor_content', 'wp_richedit_pre');
            } else {
                add_filter('acf_the_editor_content', 'wp_htmledit_pre');
            }
            $field['value'] = apply_filters('acf_the_editor_content', $field['value']);
            ?>
		<div id="wp-<?php 
            echo $id;
            ?>
-wrap" class="acf-wysiwyg-wrap wp-core-ui wp-editor-wrap <?php 
            echo $switch_class;
            ?>
" data-toolbar="<?php 
            echo $field['toolbar'];
            ?>
" data-upload="<?php 
            echo $field['media_upload'];
            ?>
">
			<div id="wp-<?php 
            echo $id;
            ?>
-editor-tools" class="wp-editor-tools hide-if-no-js">
				<?php 
            if ($field['media_upload']) {
                ?>
				<div id="wp-<?php 
                echo $id;
                ?>
-media-buttons" class="wp-media-buttons">
					<?php 
                do_action('media_buttons');
                ?>
				</div>
				<?php 
            }
            ?>
				<?php 
            if (user_can_richedit() && $show_tabs) {
                ?>
					<div class="wp-editor-tabs">
						<a id="<?php 
                echo $id;
                ?>
-html" class="wp-switch-editor switch-html" onclick="switchEditors.switchto(this);"><?php 
                echo _x('Text', 'Name for the Text editor tab (formerly HTML)');
                ?>
</a>
						<a id="<?php 
                echo $id;
                ?>
-tmce" class="wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);"><?php 
                echo __('Visual');
                ?>
</a>
					</div>
				<?php 
            }
            ?>
			</div>
			<div id="wp-<?php 
            echo $id;
            ?>
-editor-container" class="wp-editor-container">
				<textarea id="<?php 
            echo $id;
            ?>
" class="wp-editor-area" name="<?php 
            echo $field['name'];
            ?>
" <?php 
//.........这里部分代码省略.........
开发者ID:mariussunde,项目名称:Sn-hetta-Designmanual-WP-Theme,代码行数:101,代码来源:wysiwyg.php

示例9: the_field

            <div class="pnl">
            	<a href="<?php 
echo $pnl;
?>
">privacy</a> &amp; <a href="<?php 
echo $legal;
?>
">legal</a> | <a href="<?php 
echo $sitemap;
?>
">sitemap</a>
            </div><!-- pnl -->
            <div class="clear"></div>
           <div class="pnl"> site by <a href="http://bellaworksweb.com">bellaworks</a></div>
        </div><!-- footer left -->
        
        
        
		</div><!-- .site-info -->
	</footer><!-- #colophon -->
</div><!-- #page -->

<?php 
the_field('google_analytics', 'option');
acf_enqueue_uploader();
wp_footer();
?>

<!-- liquid web -->
</body>
</html>
开发者ID:accrane,项目名称:Qcity,代码行数:31,代码来源:footer.php

示例10: render_field

    function render_field($field)
    {
        // enqueue
        acf_enqueue_uploader();
        // vars
        $id = uniqid('acf-editor-');
        //$id = $field['id'] . '-' . uniqid();
        $mode = 'html';
        $show_tabs = true;
        // get height
        $height = acf_get_user_setting('wysiwyg_height', 300);
        $height = max($height, 300);
        // minimum height is 300
        // detect mode
        // case: visual tab only
        if ($field['tabs'] == 'visual') {
            $mode = 'tmce';
            $show_tabs = false;
        } elseif ($field['tabs'] == 'text') {
            $show_tabs = false;
        } elseif (wp_default_editor() == 'tinymce') {
            $mode = 'tmce';
        }
        // mode
        $switch_class = $mode . '-active';
        // filter value for editor
        remove_all_filters('acf_the_editor_content');
        if ($mode == 'tmce') {
            add_filter('acf_the_editor_content', 'wp_richedit_pre');
        } else {
            add_filter('acf_the_editor_content', 'wp_htmledit_pre');
        }
        global $q_config, $wp_version;
        $languages = qtrans_getSortedLanguages(true);
        $values = qtrans_split($field['value'], $quicktags = true);
        $currentLanguage = $this->plugin->get_active_language();
        echo '<div class="multi-language-field multi-language-field-wysiwyg">';
        foreach ($languages as $language) {
            $class = $language === $currentLanguage ? 'wp-switch-editor current-language' : 'wp-switch-editor';
            echo '<a class="' . $class . '" data-language="' . $language . '">' . $q_config['language_name'][$language] . '</a>';
        }
        $uid = uniqid('acf-editor-');
        foreach ($languages as $language) {
            $value = apply_filters('acf_the_editor_content', $values[$language]);
            $id = $uid . "-{$language}";
            $name = $field['name'] . "[{$language}]";
            $class = $switch_class;
            if ($language === $currentLanguage) {
                $class .= ' current-language';
            }
            ?>
			<div id="wp-<?php 
            echo $id;
            ?>
-wrap" class="acf-editor-wrap wp-core-ui wp-editor-wrap <?php 
            echo $class;
            ?>
" data-toolbar="<?php 
            echo $field['toolbar'];
            ?>
" data-upload="<?php 
            echo $field['media_upload'];
            ?>
" data-language="<?php 
            echo $language;
            ?>
">
				<div id="wp-<?php 
            echo $id;
            ?>
-editor-tools" class="wp-editor-tools hide-if-no-js">
					<?php 
            if ($field['media_upload']) {
                ?>
					<div id="wp-<?php 
                echo $id;
                ?>
-media-buttons" class="wp-media-buttons">
						<?php 
                do_action('media_buttons');
                ?>
					</div>
					<?php 
            }
            ?>
					<?php 
            if (user_can_richedit() && $show_tabs) {
                ?>
						<div class="wp-editor-tabs">
							<button id="<?php 
                echo $id;
                ?>
-tmce" class="wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);" type="button"><?php 
                echo __('Visual', 'acf');
                ?>
</button>
							<button id="<?php 
                echo $id;
                ?>
-html" class="wp-switch-editor switch-html" onclick="switchEditors.switchto(this);" type="button"><?php 
//.........这里部分代码省略.........
开发者ID:AndreyLanko,项目名称:perevorot-prozorro-wp,代码行数:101,代码来源:wysiwyg.php

示例11: render_field

        function render_field($field)
        {
            // enqueue
            acf_enqueue_uploader();
            // vars
            $id = 'wysiwyg-' . $field['id'] . '-' . uniqid();
            // filter value for editor
            remove_all_filters('acf_the_editor_content');
            if (user_can_richedit()) {
                add_filter('acf_the_editor_content', 'wp_richedit_pre');
            } else {
                add_filter('acf_the_editor_content', 'wp_htmledit_pre');
            }
            $field['value'] = apply_filters('acf_the_editor_content', $field['value']);
            ?>
		<div id="wp-<?php 
            echo $id;
            ?>
-wrap" class="acf-wysiwyg-wrap wp-core-ui wp-editor-wrap tmce-active" data-toolbar="<?php 
            echo $field['toolbar'];
            ?>
" data-upload="<?php 
            echo $field['media_upload'];
            ?>
">
			<?php 
            if (user_can_richedit() && $field['media_upload']) {
                ?>
				<div id="wp-<?php 
                echo $id;
                ?>
-editor-tools" class="wp-editor-tools hide-if-no-js">
					<div id="wp-<?php 
                echo $id;
                ?>
-media-buttons" class="wp-media-buttons">
						<?php 
                do_action('media_buttons');
                ?>
					</div>
				</div>
			<?php 
            }
            ?>
			<div id="wp-<?php 
            echo $id;
            ?>
-editor-container" class="wp-editor-container">
				<textarea id="<?php 
            echo $id;
            ?>
" class="wp-editor-area" name="<?php 
            echo $field['name'];
            ?>
"><?php 
            echo $field['value'];
            ?>
</textarea>
			</div>
		</div>
		<?php 
        }
开发者ID:pellio11,项目名称:ns-select-project,代码行数:62,代码来源:wysiwyg.php

示例12: render_field

    function render_field($field)
    {
        global $q_config;
        $languages = qtrans_getSortedLanguages(true);
        $values = qtrans_split($field['value'], $quicktags = true);
        $currentLanguage = $this->plugin->get_active_language();
        // enqueue
        acf_enqueue_uploader();
        // vars
        $div = array('class' => 'acf-image-uploader acf-cf', 'data-preview_size' => $field['preview_size'], 'data-library' => $field['library'], 'data-mime_types' => $field['mime_types']);
        $input_atts = array('type' => 'hidden', 'name' => $field['name'], 'value' => $field['value'], 'data-name' => 'value-id');
        $url = '';
        echo '<div class="multi-language-field multi-language-field-image">';
        foreach ($languages as $language) {
            $class = 'wp-switch-editor';
            if ($language === $currentLanguage) {
                $class .= ' current-language';
            }
            echo '<a class="' . $class . '" data-language="' . $language . '">' . $q_config['language_name'][$language] . '</a>';
        }
        foreach ($languages as $language) {
            $input_atts['name'] = $field['name'] . '[' . $language . ']';
            $field['value'] = $values[$language];
            $div['data-language'] = $language;
            $div['class'] = 'acf-image-uploader acf-cf';
            // has value?
            if ($field['value'] && is_numeric($field['value'])) {
                $url = wp_get_attachment_image_src($field['value'], $field['preview_size']);
                $url = $url[0];
                $div['class'] .= ' has-value';
            }
            // basic?
            $basic = !current_user_can('upload_files');
            if ($basic) {
                $div['class'] .= ' basic';
            }
            if ($language === $currentLanguage) {
                $div['class'] .= ' current-language';
            }
            ?>
			<div <?php 
            acf_esc_attr_e($div);
            ?>
>
				<div class="acf-hidden">
					<?php 
            acf_hidden_input(array('name' => $input_atts['name'], 'value' => $field['value'], 'data-name' => 'id'));
            ?>
				</div>
				<div class="view show-if-value acf-soh">
					<img data-name="image" src="<?php 
            echo $url;
            ?>
" alt=""/>
					<ul class="acf-hl acf-soh-target">
						<?php 
            if (!$basic) {
                ?>
							<li><a class="acf-icon dark" data-name="edit" href="#"><i class="acf-sprite-edit"></i></a></li>
						<?php 
            }
            ?>
						<li><a class="acf-icon dark" data-name="remove" href="#"><i class="acf-sprite-delete"></i></a></li>
					</ul>
				</div>
				<div class="view hide-if-value">
					<?php 
            if ($basic) {
                ?>
						<?php 
                if ($field['value'] && !is_numeric($field['value'])) {
                    ?>
							<div class="acf-error-message"><p><?php 
                    echo $field['value'];
                    ?>
</p></div>
						<?php 
                }
                ?>
						<input type="file" name="<?php 
                echo $field['name'];
                ?>
" id="<?php 
                echo $field['id'];
                ?>
" />
					<?php 
            } else {
                ?>
						<p style="margin:0;"><?php 
                _e('No image selected', 'acf');
                ?>
 <a data-name="add" class="acf-button" href="#"><?php 
                _e('Add Image', 'acf');
                ?>
</a></p>
					<?php 
            }
            ?>
				</div>
//.........这里部分代码省略.........
开发者ID:AndreyLanko,项目名称:perevorot-prozorro-wp,代码行数:101,代码来源:image.php

示例13: acf_form_data

function acf_form_data($args = array())
{
    // make sure scripts and styles have been included
    // case: front end bbPress edit user
    acf_enqueue_scripts();
    // defaults
    $args = acf_parse_args($args, array('post_id' => 0, 'nonce' => 'post', 'validation' => 1, 'ajax' => 0));
    // save form_data for later actions
    acf_update_setting('form_data', $args);
    // enqueue uploader if page allows AJAX fields to appear
    if ($args['ajax']) {
        acf_enqueue_uploader();
    }
    ?>
	<div id="acf-form-data" class="acf-hidden">
		<input type="hidden" name="_acfnonce" value="<?php 
    echo wp_create_nonce($args['nonce']);
    ?>
" />
		<input type="hidden" name="_acfchanged" value="0" />
		<?php 
    do_action('acf/input/form_data', $args);
    ?>
	</div>
	<?php 
}
开发者ID:dleatherman,项目名称:timbangular-js,代码行数:26,代码来源:input.php

示例14: render_field

        function render_field($field)
        {
            // enqueue
            acf_enqueue_uploader();
            // vars
            $o = array('class' => 'acf-file-uploader acf-cf', 'icon' => '', 'title' => '', 'size' => '', 'url' => '', 'name' => '');
            if ($field['value'] && is_numeric($field['value'])) {
                $file = get_post($field['value']);
                if ($file) {
                    $o['class'] .= ' has-value';
                    $o['icon'] = wp_mime_type_icon($file->ID);
                    $o['title'] = $file->post_title;
                    $o['size'] = @size_format(filesize(get_attached_file($file->ID)));
                    $o['url'] = wp_get_attachment_url($file->ID);
                    $explode = explode('/', $o['url']);
                    $o['name'] = end($explode);
                }
            }
            // basic?
            $basic = !current_user_can('upload_files');
            if ($basic) {
                $o['class'] .= ' basic';
            }
            ?>
<div <?php 
            acf_esc_attr_e(array('class' => $o['class'], 'data-library' => $field['library']));
            ?>
>
	<div class="acf-hidden">
		<input type="hidden" <?php 
            acf_esc_attr_e(array('name' => $field['name'], 'value' => $field['value'], 'data-name' => 'id'));
            ?>
 />	
	</div>
	<div class="show-if-value file-wrap acf-soh">
		<div class="file-icon">
			<img data-name="icon" src="<?php 
            echo $o['icon'];
            ?>
" alt=""/>
		</div>
		<div class="file-info">
			<p>
				<strong data-name="title"><?php 
            echo $o['title'];
            ?>
</strong>
			</p>
			<p>
				<strong><?php 
            _e('File Name', 'acf');
            ?>
:</strong>
				<a data-name="name" href="<?php 
            echo $o['url'];
            ?>
" target="_blank"><?php 
            echo $o['name'];
            ?>
</a>
			</p>
			<p>
				<strong><?php 
            _e('File Size', 'acf');
            ?>
:</strong>
				<span data-name="size"><?php 
            echo $o['size'];
            ?>
</span>
			</p>
			
			<ul class="acf-hl acf-soh-target">
				<?php 
            if (!$basic) {
                ?>
					<li><a class="acf-icon dark" data-name="edit" href="#"><i class="acf-sprite-edit"></i></a></li>
				<?php 
            }
            ?>
				<li><a class="acf-icon dark" data-name="remove" href="#"><i class="acf-sprite-delete"></i></a></li>
			</ul>
			
		</div>
	</div>
	<div class="hide-if-value">
		<?php 
            if ($basic) {
                ?>
			
			<?php 
                if ($field['value'] && !is_numeric($field['value'])) {
                    ?>
				<div class="acf-error-message"><p><?php 
                    echo $field['value'];
                    ?>
</p></div>
			<?php 
                }
                ?>
//.........这里部分代码省略.........
开发者ID:mariussunde,项目名称:Sn-hetta-Designmanual-WP-Theme,代码行数:101,代码来源:file.php

示例15: render_field

        function render_field($field)
        {
            // enqueue
            acf_enqueue_uploader();
            // vars
            $posts = array();
            $atts = array('id' => $field['id'], 'class' => "acf-gallery {$field['class']}", 'data-preview_size' => $field['preview_size'], 'data-library' => $field['library'], 'data-min' => $field['min'], 'data-max' => $field['max'], 'data-mime_types' => $field['mime_types']);
            // set gallery height
            $height = acf_get_user_setting('gallery_height', 400);
            $height = max($height, 200);
            // minimum height is 200
            $atts['style'] = "height:{$height}px";
            // load posts
            if (!empty($field['value'])) {
                $posts = acf_get_posts(array('post_type' => 'attachment', 'post__in' => $field['value']));
            }
            ?>
<div <?php 
            acf_esc_attr_e($atts);
            ?>
>
	
	<div class="acf-hidden">
		<input type="hidden" <?php 
            acf_esc_attr_e(array('name' => $field['name'], 'value' => '', 'data-name' => 'ids'));
            ?>
 />
	</div>
	
	<div class="acf-gallery-main">
		
		<div class="acf-gallery-attachments">
			
			<?php 
            if (!empty($posts)) {
                ?>
			
				<?php 
                foreach ($posts as $post) {
                    // vars
                    $type = acf_maybe_get(explode('/', $post->post_mime_type), 0);
                    $thumb_id = $post->ID;
                    $thumb_url = '';
                    $thumb_class = 'acf-gallery-attachment acf-soh';
                    $filename = wp_basename($post->guid);
                    // thumb
                    if ($type === 'image' || $type === 'audio' || $type === 'video') {
                        // change $thumb_id
                        if ($type === 'audio' || $type === 'video') {
                            $thumb_id = get_post_thumbnail_id($post->ID);
                        }
                        // get attachment
                        if ($thumb_id) {
                            $thumb_url = wp_get_attachment_image_src($thumb_id, $field['preview_size']);
                            $thumb_url = acf_maybe_get($thumb_url, 0);
                        }
                    }
                    // fallback
                    if (!$thumb_url) {
                        $thumb_url = wp_mime_type_icon($post->ID);
                        $thumb_class .= ' is-mime-icon';
                    }
                    ?>
					<div class="<?php 
                    echo $thumb_class;
                    ?>
" data-id="<?php 
                    echo $post->ID;
                    ?>
">
						<input type="hidden" name="<?php 
                    echo $field['name'];
                    ?>
[]" value="<?php 
                    echo $post->ID;
                    ?>
" />
						<div class="margin" title="<?php 
                    echo $filename;
                    ?>
">
							<div class="thumbnail">
								<img src="<?php 
                    echo $thumb_url;
                    ?>
"/>
							</div>
							<?php 
                    if ($type !== 'image') {
                        ?>
							<div class="filename"><?php 
                        echo acf_get_truncated($filename, 18);
                        ?>
</div>
							<?php 
                    }
                    ?>
						</div>
						<div class="actions acf-soh-target">
							<a class="acf-icon dark remove-attachment" data-id="<?php 
//.........这里部分代码省略.........
开发者ID:TMBR,项目名称:johnjohn,代码行数:101,代码来源:gallery.php


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