本文整理汇总了PHP中WF函数的典型用法代码示例。如果您正苦于以下问题:PHP WF函数的具体用法?PHP WF怎么用?PHP WF使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WF函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_field_upload_min
/**
* Render HTML markup for the "upload_min" field type.
* @access protected
* @since 6.0.0
* @param string $key The unique ID of this field.
* @param array $args Arguments used to construct this field.
* @return string HTML markup for the field.
*/
protected function render_field_upload_min($key, $args)
{
$this->_has_upload = true;
$url = $this->get_value($key, $args['std']);
$id = $this->get_value($key . '-id', 0);
$placeholder = WF()->get_placeholder_image_url();
$class = ' no-image';
if ('' != $url || 0 < intval($id)) {
$class = ' has-image';
}
$html = '<span class="upload-field">' . "\n";
$html .= '<input id="' . esc_attr($key) . '" name="' . esc_attr($key) . '" type="hidden" class="input-upload" value="' . esc_attr($url) . '" /> <a href="#" class="button" data-uploader-title="' . esc_attr(sprintf(__('Select %s', 'woothemes'), $args['name'])) . '" data-uploader-button-text="' . esc_attr(sprintf(__('Use image as %s', 'woothemes'), $args['name'])) . '">' . __('Upload', 'woothemes') . '</a>' . "\n";
$html .= '<input id="' . esc_attr($key) . '-id" name="' . esc_attr($key) . '-id" type="hidden" class="input-upload-id" value="' . esc_attr($id) . '" /> ' . "\n";
$html .= '</span>' . "\n";
$html .= '<div class="image-preview' . esc_attr($class) . '">' . "\n";
$html .= '<img src="' . esc_url($url) . '" data-placeholder="' . esc_url($placeholder) . '" />' . "\n";
$html .= '<a href="#" class="remove">' . sprintf(__('Remove %s', 'woothemes'), $args['name']) . '</a>' . "\n";
$html .= '</div><!--/.image-preview-->' . "\n";
return $html;
}
示例2: WF
// A class to handle all basic settings interactions.
require_once $classes_path . 'class-wf-meta.php';
// Meta box generator class.
/**
* Returns the main instance of WF to prevent the need to use globals.
*
* @since 1.0.0
* @return object WF
*/
function WF()
{
return WF::instance();
}
// End WF()
// Run the WF() function to generate the initial instance.
WF();
// Load the other WooFramework files.
require_once $functions_path . 'admin-functions.php';
// Functions used in the WooFramework and in the theme files.
require_once $functions_path . 'admin-setup.php';
// Set up the WooFramework.
require_once $functions_path . 'admin-interface.php';
// Administration interfaces.
require_once $functions_path . 'admin-seo.php';
// SEO functions.
require_once $functions_path . 'admin-sbm.php';
// Widget Area functions.
require_once $functions_path . 'admin-hooks.php';
// Contextual hooks.
if (true == (bool) apply_filters('wf_enable_custom_nav', false)) {
require_once $functions_path . 'admin-custom-nav.php';
示例3: woo_option_setup
/**
* Update theme options in database with options as stored in theme.
* @since 1.0.0
* @return void
*/
function woo_option_setup()
{
//Update EMPTY options
$woo_array = array();
add_option('woo_options', $woo_array);
$woo_array = WF()->settings->get_all();
// Allow child themes/plugins to filter here.
$woo_array = apply_filters('woo_options_array', $woo_array);
update_option('woo_options', $woo_array);
}
示例4: woo_get_dynamic_values
function woo_get_dynamic_values($settings)
{
$all = WF()->settings->get_all();
if (is_array($all) && 0 < count($all)) {
foreach ($settings as $k => $v) {
$k = str_replace('woo_', '', $k);
// Make sure we remove the prefix.
if (isset($all['woo_' . $k])) {
$settings[$k] = $all['woo_' . $k];
}
}
}
return (array) apply_filters('woo_get_dynamic_values', $settings);
}
示例5: printf
<li><?php
printf(__('Version %s', 'woothemes'), '<strong>' . $ct->__get('Version') . '</strong>');
?>
</li>
<?php
if ($ct->parent()) {
?>
<li><?php
printf(__('%s Version %s', 'woothemes'), $ct->parent()->__get('Name'), '<strong>' . $ct->parent()->__get('Version') . '</strong>');
?>
</li>
<?php
}
if (current_user_can('install_themes')) {
?>
<li><?php
printf(__('WooFramework %s - %s', 'woothemes'), '<strong>' . $this->_theme_data['framework_version'] . '</strong>', sprintf(__('%sUpdate%s', 'woothemes') . ' <span class="dashicons dashicons-update"></span>', '<a href="' . esc_url(add_query_arg('page', 'woothemes_framework_update', admin_url('admin.php'))) . '">', '</a>'));
?>
</li>
<?php
}
?>
</ul>
<hr />
<?php
}
}
// End Class
WF()->screens['welcome'] = new WF_Screen_Welcome();
示例6: _e
</td>
<td class="version">
<?php
echo $this->_theme_data['theme_version'];
?>
</td>
</tr>
</tbody>
<tfoot>
<tr class="odd">
<td>
<strong><?php
_e('WooFramework', 'woothemes');
?>
</strong>
</td>
<td class="version">
<?php
echo $this->_theme_data['framework_version'];
?>
</td>
</tr>
</tfoot>
</table>
<?php
}
}
// End Class
WF()->screens['framework'] = new WF_Screen_Framework();
示例7: woo_image
//.........这里部分代码省略.........
}
$thumb_id = $att_id;
$is_auto_image = true;
}
// Get the first img tag from content
} else {
$first_img = '';
$post = get_post($id);
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
if (!empty($matches[1][0])) {
// Save Image URL
$custom_field = esc_url($matches[1][0]);
// Search for ALT tag
$output = preg_match_all('/<img.+alt=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
if (!empty($matches[1][0])) {
$alt = esc_attr($matches[1][0]);
}
}
}
}
// Check if there is YouTube embed
if (empty($custom_field) && empty($img_link)) {
$embed = esc_html(get_post_meta($id, 'embed', true));
if ($embed) {
$custom_field = esc_url(woo_get_video_image($embed));
}
}
// Return if there is no attachment or custom field set
if (empty($custom_field) && empty($img_link)) {
// Check if default placeholder image is uploaded
// $placeholder = get_option( 'framework_woo_default_image' );
$placeholder = WF()->get_placeholder_image_url();
if ($placeholder && !(is_singular() && in_the_loop())) {
$custom_field = esc_url($placeholder);
// Resize the placeholder if
if (get_option('woo_post_image_support') == 'true' && get_option('woo_pis_resize') == 'true') {
// Dynamically resize the post thumbnail
$vt_crop = get_option('woo_pis_hard_crop');
if ($vt_crop == 'true') {
$vt_crop = true;
} else {
$vt_crop = false;
}
$vt_image = vt_resize('', $placeholder, $width, $height, $vt_crop);
// Set fields for output
$custom_field = esc_url($vt_image['url']);
$width = $vt_image['width'];
$height = $vt_image['height'];
}
} else {
return;
}
}
if (empty($src_arr) && empty($img_link)) {
$src_arr[] = $custom_field;
}
/* ------------------------------------------------------------------------- */
/* BEGIN OUTPUT */
/* ------------------------------------------------------------------------- */
$output = '';
// Set output height and width
$set_width = ' width="' . esc_attr($width) . '" ';
$set_height = '';
if (!$noheight && 0 < $height) {
示例8: wf_load_admin_css
/**
* Load admin CSS on specific screens.
* @since 6.0.0
* @return void
*/
function wf_load_admin_css()
{
$load_on = (array) apply_filters('wf_load_admin_css', array('woothemes', 'wf-framework', 'woothemes-backup'));
wp_register_style('wf-admin', esc_url(WF()->get_assets_url() . 'css/admin.css'), array(), '1.0.0', 'all');
if (isset($_GET['page']) && in_array($_GET['page'], $load_on)) {
wp_enqueue_style('wf-admin');
}
}