本文整理汇总了PHP中wpb_debug函数的典型用法代码示例。如果您正苦于以下问题:PHP wpb_debug函数的具体用法?PHP wpb_debug怎么用?PHP wpb_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpb_debug函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpb_resize
function wpb_resize( $attach_id = null, $img_url = null, $width, $height, $crop = false ) {
// this is an attachment, so we have the ID
if ( $attach_id ) {
$image_src = wp_get_attachment_image_src( $attach_id, 'full' );
$actual_file_path = get_attached_file( $attach_id );
// this is not an attachment, let's use the image url
} else if ( $img_url ) {
$file_path = parse_url( $img_url );
$actual_file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];
$actual_file_path = ltrim( $file_path['path'], '/' );
$actual_file_path = rtrim( ABSPATH, '/' ) . $file_path['path'];
$orig_size = getimagesize( $actual_file_path );
$image_src[0] = $img_url;
$image_src[1] = $orig_size[0];
$image_src[2] = $orig_size[1];
}
$file_info = pathinfo( $actual_file_path );
$extension = '.' . $file_info['extension'];
// the image path without the extension
$no_ext_path = $file_info['dirname'] . '/' . $file_info['filename'];
$cropped_img_path = $no_ext_path . '-' . $width . 'x' . $height . $extension;
// checking if the file size is larger than the target size
// if it is smaller or the same size, stop right here and return
if ( $image_src[1] > $width || $image_src[2] > $height ) {
// the file is larger, check if the resized version already exists (for $crop = true but will also work for $crop = false if the sizes match)
if ( file_exists( $cropped_img_path ) ) {
$cropped_img_url = str_replace( basename( $image_src[0] ), basename( $cropped_img_path ), $image_src[0] );
$vt_image = array(
'url' => $cropped_img_url,
'width' => $width,
'height' => $height
);
return $vt_image;
}
// $crop = false
if ( $crop == false ) {
// calculate the size proportionaly
$proportional_size = wp_constrain_dimensions( $image_src[1], $image_src[2], $width, $height );
$resized_img_path = $no_ext_path . '-' . $proportional_size[0] . 'x' . $proportional_size[1] . $extension;
// checking if the file already exists
if ( file_exists( $resized_img_path ) ) {
$resized_img_url = str_replace( basename( $image_src[0] ), basename( $resized_img_path ), $image_src[0] );
$vt_image = array(
'url' => $resized_img_url,
'width' => $proportional_size[0],
'height' => $proportional_size[1]
);
return $vt_image;
}
}
// no cache files - let's finally resize it
$img_editor = wp_get_image_editor( $actual_file_path );
if ( is_wp_error( $img_editor ) || is_wp_error( $img_editor->resize( $width, $height, $crop ) ) ) {
return array(
'url' => '',
'width' => '',
'height' => ''
);
}
$new_img_path = $img_editor->generate_filename();
if ( is_wp_error( $img_editor->save( $new_img_path ) ) ) {
return array(
'url' => '',
'width' => '',
'height' => ''
);
}
if ( wpb_debug() ) {
var_dump( file_exists( $actual_file_path ) );
var_dump( $actual_file_path );
}
if ( ! is_string( $new_img_path ) ) {
return array(
'url' => '',
'width' => '',
'height' => ''
);
}
$new_img_size = getimagesize( $new_img_path );
$new_img = str_replace( basename( $image_src[0] ), basename( $new_img_path ), $image_src[0] );
// resized output
$vt_image = array(
'url' => $new_img,
'width' => $new_img_size[0],
'height' => $new_img_size[1]
//.........这里部分代码省略.........
示例2: adminLoad
/**
* Set up the enqueue for the CSS & JavaScript files.
*
*/
function adminLoad()
{
wp_register_script('wpb_js_composer_settings', vc_asset_url('js/dist/settings.min.js'), array(), WPB_VC_VERSION, true);
wp_enqueue_style('js_composer_settings', vc_asset_url('css/js_composer_settings.min.css'), false, WPB_VC_VERSION, false);
wp_enqueue_script('backbone');
wp_enqueue_script('shortcode');
wp_enqueue_script('underscore');
wp_enqueue_script('jquery-ui-accordion');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('wpb_js_composer_settings');
$this->locale = array('are_you_sure_reset_css_classes' => __('Are you sure you want to reset to defaults?', 'js_composer'), 'are_you_sure_reset_color' => __('Are you sure you want to reset to defaults?', 'js_composer'), 'saving' => __('Saving...', 'js_composer'), 'save' => __('Save Changes', 'js_composer'), 'saved' => __('Design Options successfully saved.', 'js_composer'), 'save_error' => __('Design Options could not be saved', 'js_composer'), 'form_save_error' => __('Problem with AJAX request execution, check internet connection and try again.', 'js_composer'), 'are_you_sure_delete' => __('Are you sure you want to delete this shortcode?', 'js_composer'), 'are_you_sure_delete_param' => __("Are you sure you want to delete the shortcode's param?", 'js_composer'), 'my_shortcodes_category' => __('My shortcodes', 'js_composer'), 'error_shortcode_name_is_required' => __('Shortcode name is required.', 'js_composer'), 'error_enter_valid_shortcode_tag' => __('Please enter valid shortcode tag.', 'js_composer'), 'error_enter_required_fields' => __('Please enter all required fields for params.', 'js_composer'), 'new_shortcode_mapped' => __('New shortcode mapped from string!', 'js_composer'), 'shortcode_updated' => __('Shortcode updated!', 'js_composer'), 'error_content_param_not_manually' => __('Content param can not be added manually, please use checkbox.', 'js_composer'), 'error_param_already_exists' => __('Param %s already exists. Param names must be unique.', 'js_composer'), 'error_wrong_param_name' => __('Please use only letters, numbers and underscore for param name', 'js_composer'), 'error_enter_valid_shortcode' => __('Please enter valid shortcode to parse!', 'js_composer'));
wp_localize_script('wpb_js_composer_settings', 'vcData', apply_filters('vc_global_js_data', array('version' => WPB_VC_VERSION, 'debug' => wpb_debug())));
wp_localize_script('wpb_js_composer_settings', 'i18nLocaleSettings', $this->locale);
}
示例3: content
protected function content($atts, $content = null)
{
$title = $type = $onclick = $custom_links = $img_size = '';
$width = $images = $el_class = $interval = $el_position = '';
extract(shortcode_atts(array('title' => '', 'type' => 'flexslider', 'onclick' => 'link_image', 'custom_links' => '', 'img_size' => 'thumbnail', 'width' => '1/1', 'images' => '', 'el_class' => '', 'interval' => '5', 'el_position' => ''), $atts));
$output = '';
$gal_images = '';
$link_start = '';
$link_end = '';
$el_start = '';
$el_end = '';
$slides_wrap_start = '';
$slides_wrap_end = '';
$el_class = $this->getExtraClass($el_class);
$width = wpb_translateColumnWidthToSpan($width);
if ($type == 'nivo') {
$type = ' wpb_slider_nivo';
wp_enqueue_script('nivo-slider');
} else {
if ($type == 'flexslider' || $type == 'flexslider_fade' || $type == 'flexslider_slide' || $type == 'fading') {
$el_start = '<li>';
$el_end = '</li>';
$slides_wrap_start = '<ul class="slides">';
$slides_wrap_end = '</ul>';
wp_enqueue_style('flexslider');
wp_enqueue_script('flexslider');
} else {
if ($type == 'image_grid') {
wp_enqueue_script('isotope');
$el_start = '<li class="isotope-item">';
$el_end = '</li>';
$slides_wrap_start = '<ul class="wpb_image_grid_ul">';
$slides_wrap_end = '</ul>';
}
}
}
if ($onclick == 'link_image') {
wp_enqueue_script('prettyphoto');
wp_enqueue_style('prettyphoto');
}
$flex_fx = '';
if ($type == 'flexslider' || $type == 'flexslider_fade' || $type == 'fading') {
$type = ' wpb_flexslider flexslider_fade flexslider';
$flex_fx = ' data-flex_fx="fade"';
} else {
if ($type == 'flexslider_slide') {
$type = ' wpb_flexslider flexslider_slide flexslider';
$flex_fx = ' data-flex_fx="slide"';
} else {
if ($type == 'image_grid') {
$type = ' wpb_image_grid';
}
}
}
/*
else if ( $type == 'fading' ) {
$type = ' wpb_slider_fading';
$el_start = '<li>';
$el_end = '</li>';
$slides_wrap_start = '<ul class="slides">';
$slides_wrap_end = '</ul>';
wp_enqueue_script( 'cycle' );
}*/
if ($images == '') {
return null;
}
$pretty_rel_random = 'rel-' . rand();
if ($onclick == 'custom_link') {
$custom_links = explode(',', $custom_links);
}
$images = explode(',', $images);
$i = -1;
foreach ($images as $attach_id) {
$i++;
$post_thumbnail = wpb_getImageBySize(array('attach_id' => $attach_id, 'thumb_size' => $img_size));
if (wpb_debug()) {
//var_dump($post_thumbnail);
}
$thumbnail = $post_thumbnail['thumbnail'];
$p_img_large = $post_thumbnail['p_img_large'];
if ($onclick == 'link_image') {
$link_start = '<a class="prettyphoto" rel="prettyPhoto[' . $pretty_rel_random . ']" href="' . $p_img_large . '">';
$link_end = '</a>';
} else {
if ($onclick == 'custom_link') {
$link_start = '<a href="' . $custom_links[$i] . '">';
$link_end = '</a>';
}
}
$gal_images .= $el_start . $link_start . $thumbnail . $link_end . $el_end;
}
$output .= '<div class="wpb_gallery wpb_content_element ' . $width . $el_class . '">';
$output .= '<div class="wpb_wrapper">';
$output .= $title != '' ? '<h2 class="wpb_heading wpb_teaser_grid_heading">' . $title . '</h2>' : '';
$output .= '<div class="wpb_gallery_slides' . $type . '" data-interval="' . $interval . '"' . $flex_fx . '>' . $slides_wrap_start . $gal_images . $slides_wrap_end . '</div>';
$output .= '</div>' . $this->endBlockComment('.wpb_wrapper');
$output .= '</div>' . $this->endBlockComment($width);
$output = $this->startRow($el_position) . $output . $this->endRow($el_position);
return $output;
}
示例4: registerAdminJavascript
/**
* Register admin javascript libs.
*
* Calls wp_register_script for required css libraries files for Admin dashboard.
*
* @since 3.1
* vc_filter: vc_i18n_locale_composer_js_view, since 4.4 - override localization for js
* @access public
*/
public function registerAdminJavascript()
{
/**
* TODO: REFACTOR
* Save register only core js files and check for backend or front
*/
// $this->frontJsRegister();
wp_register_script('wpb_php_js', vc_asset_url('lib/php.default/php.default.min.js'), array('jquery'), WPB_VC_VERSION, true);
wp_register_script('isotope', vc_asset_url('lib/bower/isotope/dist/isotope.pkgd.min.js'), array('jquery'), WPB_VC_VERSION, true);
wp_register_script('wpb_scrollTo_js', vc_asset_url('lib/bower/scrollTo/jquery.scrollTo.min.js'), array('jquery'), WPB_VC_VERSION, true);
wp_register_script('wpb_json-js', vc_asset_url('lib/bower/json-js/json2.js'), false, WPB_VC_VERSION, true);
wp_register_script('wpb_js_composer_js_listeners', vc_asset_url('js/lib/events.js'), array('jquery', 'backbone', 'wpb_json-js'), WPB_VC_VERSION, true);
wp_localize_script('wpb_js_composer_js_listeners', 'vcData', apply_filters('vc_global_js_data', array('version' => WPB_VC_VERSION, 'debug' => wpb_debug())));
wp_register_script('wpb_js_composer_js_tools', vc_asset_url('js/backend/composer-tools.js'), array('jquery', 'backbone', 'wpb_json-js', 'wpb_js_composer_js_listeners'), WPB_VC_VERSION, true);
wp_register_script('wpb_js_composer_settings', vc_asset_url('js/backend/composer-settings-page.js'), array('jquery', 'wpb_js_composer_js_tools'), WPB_VC_VERSION, true);
wp_register_script('wpb_jscomposer_media_editor_js', vc_asset_url('js/backend/media-editor.js'), array('media-views', 'media-editor', 'mce-view', 'wpb_js_composer_js_view'), WPB_VC_VERSION, true);
wp_register_script('wpb_js_composer_js_atts', vc_asset_url('js/params/composer-atts.js'), array('wp-color-picker', 'wpb_js_composer_js_tools'), WPB_VC_VERSION, true);
wp_register_script('wpb_js_composer_js_storage', vc_asset_url('js/backend/composer-storage.js'), array('wpb_js_composer_js_atts'), WPB_VC_VERSION, true);
wp_register_script('wpb_js_composer_js_models', vc_asset_url('js/backend/composer-models.js'), array('wpb_js_composer_js_storage'), WPB_VC_VERSION, true);
wp_register_script('wpb_js_composer_editor_panels', vc_asset_url('js/editors/panels.js'), array('wpb_js_composer_js_models'), WPB_VC_VERSION, true);
wp_register_script('wpb_js_composer_js_view', vc_asset_url('js/backend/composer-view.js'), array('wpb_js_composer_editor_panels'), WPB_VC_VERSION, true);
wp_register_script('wpb_js_composer_js_custom_views', vc_asset_url('js/backend/composer-custom-views.js'), array('wpb_js_composer_js_view'), WPB_VC_VERSION, true);
wp_register_script('wpb_jscomposer_autosuggest_js', vc_asset_url('lib/autosuggest/jquery.autoSuggest.js'), array('wpb_js_composer_js_view'), WPB_VC_VERSION, true);
wp_register_script('wpb_jscomposer_teaser_js', vc_asset_url('js/backend/composer-teaser.js'), array(), WPB_VC_VERSION, true);
if (!vc_is_as_theme() || vc_is_as_theme() && 'admin_settings_page' !== vc_mode()) {
wp_register_script('ace-editor', vc_asset_url('lib/bower/ace-builds/src-min-noconflict/ace.js'), array('jquery'), WPB_VC_VERSION, true);
}
/**
* vc_filter: vc_i18n_locale_composer_js_view - @since 4.4
*/
wp_localize_script('wpb_js_composer_js_view', 'i18nLocale', apply_filters('vc_i18n_locale_composer_js_view', array('add_remove_picture' => __('Add/remove picture', 'js_composer'), 'finish_adding_text' => __('Finish Adding Images', 'js_composer'), 'add_image' => __('Add Image', 'js_composer'), 'add_images' => __('Add Images', 'js_composer'), 'settings' => __('Settings', 'js_composer'), 'main_button_title' => __('Visual Composer', 'js_composer'), 'main_button_title_backend_editor' => __('BACKEND EDITOR', 'js_composer'), 'main_button_title_frontend_editor' => __('FRONTEND EDITOR', 'js_composer'), 'main_button_title_revert' => __('CLASSIC MODE', 'js_composer'), 'please_enter_templates_name' => __('Please enter template name', 'js_composer'), 'confirm_deleting_template' => __('Confirm deleting "{template_name}" template, press Cancel to leave. This action cannot be undone.', 'js_composer'), 'press_ok_to_delete_section' => __('Press OK to delete section, Cancel to leave', 'js_composer'), 'drag_drop_me_in_column' => __('Drag and drop me in the column', 'js_composer'), 'press_ok_to_delete_tab' => __('Press OK to delete "{tab_name}" tab, Cancel to leave', 'js_composer'), 'slide' => __('Slide', 'js_composer'), 'tab' => __('Tab', 'js_composer'), 'section' => __('Section', 'js_composer'), 'please_enter_new_tab_title' => __('Please enter new tab title', 'js_composer'), 'press_ok_delete_section' => __('Press OK to delete "{tab_name}" section, Cancel to leave', 'js_composer'), 'section_default_title' => __('Section', 'js_composer'), 'please_enter_section_title' => __('Please enter new section title', 'js_composer'), 'error_please_try_again' => __('Error. Please try again.', 'js_composer'), 'if_close_data_lost' => __('If you close this window all shortcode settings will be lost. Close this window?', 'js_composer'), 'header_select_element_type' => __('Select element type', 'js_composer'), 'header_media_gallery' => __('Media gallery', 'js_composer'), 'header_element_settings' => __('Element settings', 'js_composer'), 'add_tab' => __('Add tab', 'js_composer'), 'are_you_sure_convert_to_new_version' => __('Are you sure you want to convert to new version?', 'js_composer'), 'loading' => __('Loading...', 'js_composer'), 'set_image' => __('Set Image', 'js_composer'), 'are_you_sure_reset_css_classes' => __('Are you sure that you want to remove all your data?', 'js_composer'), 'loop_frame_title' => __('Loop settings'), 'enter_custom_layout' => __('Custom row layout', 'js_composer'), 'wrong_cells_layout' => __('Wrong row layout format! Example: 1/2 + 1/2 or span6 + span6.', 'js_composer'), 'row_background_color' => __('Row background color', 'js_composer'), 'row_background_image' => __('Row background image', 'js_composer'), 'column_background_color' => __('Column background color', 'js_composer'), 'column_background_image' => __('Column background image', 'js_composer'), 'guides_on' => __('Guides ON', 'js_composer'), 'guides_off' => __('Guides OFF', 'js_composer'), 'template_save' => __('New template successfully saved!', 'js_composer'), 'template_added' => __('Template added to the page.', 'js_composer'), 'template_added_with_id' => __('Template added to the page. Template has ID attributes, make sure that they are not used more than once on the same page.', 'js_composer'), 'template_removed' => __('Template successfully removed.', 'js_composer'), 'template_is_empty' => __('Nothing to save. Template is empty.', 'js_composer'), 'css_updated' => __('Page settings updated!', 'js_composer'), 'update_all' => __('Update all', 'js_composer'), 'confirm_to_leave' => __('The changes you made will be lost if you navigate away from this page.', 'js_composer'), 'inline_element_saved' => __('%s saved!', 'js_composer'), 'inline_element_deleted' => __('%s deleted!', 'js_composer'), 'inline_element_cloned' => __('%s cloned. <a href="#" class="vc_edit-cloned" data-model-id="%s">Edit now?</a>', 'js_composer'), 'gfonts_loading_google_font_failed' => __('Loading Google Font failed', 'js_composer'), 'gfonts_loading_google_font' => __('Loading Font...', 'js_composer'), 'gfonts_unable_to_load_google_fonts' => __('Unable to load Google Fonts', 'js_composer'), 'no_title_parenthesis' => sprintf('(%s)', __('no title', 'js_composer')), 'error_while_saving_image_filtered' => __('Error while applying filter to the image. Check your server and memory settings.', 'js_composer'))));
/**
* @since 4.4
*/
do_action('vc_base_register_admin_js');
}
示例5: debugComment
/**
* if wpb_debug=true return HTML comment
*
* @since 4.7
*
* @param string $comment
*
* @return string
*/
public function debugComment($comment)
{
return wpb_debug() ? '<!-- ' . $comment . ' -->' : '';
}
示例6: endBlockComment
/**
* Create HTML comment for blocks only if wpb_debug=true
*
* @param $string
*
* @return string
*/
public function endBlockComment($string)
{
//return '';
return wpb_debug() ? '<!-- END ' . $string . ' -->' : '';
}
示例7: content
protected function content($atts, $content = null)
{
$title = $type = $onclick = $custom_links = $img_size = $custom_links_target = '';
$width = $images = $el_class = $interval = $el_position = '';
extract(shortcode_atts(array('title' => '', 'type' => 'flexslider', 'onclick' => 'link_image', 'custom_links' => '', 'custom_links_target' => '', 'img_size' => 'thumbnail', 'width' => '1/1', 'images' => '', 'el_class' => '', 'interval' => '5', 'el_position' => ''), $atts));
$output = '';
$gal_images = '';
$link_start = '';
$link_end = '';
$el_start = '';
$el_end = '';
$slides_wrap_start = '';
$slides_wrap_end = '';
$el_class = $this->getExtraClass($el_class);
$width = '';
//wpb_translateColumnWidthToSpan($width);
if ($type == 'nivo') {
$type = ' wpb_slider_nivo';
wp_enqueue_script('nivo-slider');
wp_enqueue_style('nivo-slider-css');
$slides_wrap_start = '<div class="nivoSlider">';
$slides_wrap_end = '</div>';
} else {
if ($type == 'flexslider' || $type == 'flexslider_fade' || $type == 'flexslider_slide' || $type == 'fading') {
$el_start = '<li>';
$el_end = '</li>';
$slides_wrap_start = '<ul class="slides">';
$slides_wrap_end = '</ul>';
wp_enqueue_style('flexslider');
wp_enqueue_script('flexslider');
} else {
if ($type == 'image_grid') {
wp_enqueue_script('isotope');
$el_start = '<li class="isotope-item">';
$el_end = '</li>';
$slides_wrap_start = '<ul class="wpb_image_grid_ul">';
$slides_wrap_end = '</ul>';
}
}
}
if ($onclick == 'link_image') {
wp_enqueue_script('prettyphoto');
wp_enqueue_style('prettyphoto');
}
$flex_fx = '';
if ($type == 'flexslider' || $type == 'flexslider_fade' || $type == 'fading') {
$type = ' wpb_flexslider flexslider_fade flexslider';
$flex_fx = ' data-flex_fx="fade"';
} else {
if ($type == 'flexslider_slide') {
$type = ' wpb_flexslider flexslider_slide flexslider';
$flex_fx = ' data-flex_fx="slide"';
} else {
if ($type == 'image_grid') {
$type = ' wpb_image_grid';
}
}
}
/*
else if ( $type == 'fading' ) {
$type = ' wpb_slider_fading';
$el_start = '<li>';
$el_end = '</li>';
$slides_wrap_start = '<ul class="slides">';
$slides_wrap_end = '</ul>';
wp_enqueue_script( 'cycle' );
}*/
//if ( $images == '' ) return null;
if ($images == '') {
$images = '-1,-2,-3';
}
$pretty_rel_random = 'rel-' . rand();
if ($onclick == 'custom_link') {
$custom_links = explode(',', $custom_links);
}
$images = explode(',', $images);
$i = -1;
foreach ($images as $attach_id) {
$i++;
if ($attach_id > 0) {
$post_thumbnail = wpb_getImageBySize(array('attach_id' => $attach_id, 'thumb_size' => $img_size));
} else {
$different_kitten = 400 + $i;
$post_thumbnail = array();
$post_thumbnail['thumbnail'] = '<img src="http://placekitten.com/g/' . $different_kitten . '/300" />';
$post_thumbnail['p_img_large'][0] = 'http://placekitten.com/g/1024/768';
}
if (wpb_debug()) {
//var_dump($post_thumbnail);
}
$thumbnail = $post_thumbnail['thumbnail'];
$p_img_large = $post_thumbnail['p_img_large'];
$link_start = $link_end = '';
if ($onclick == 'link_image') {
$link_start = '<a class="prettyphoto" rel="prettyPhoto[' . $pretty_rel_random . ']" href="' . $p_img_large[0] . '">';
$link_end = '</a>';
} else {
if ($onclick == 'custom_link' && isset($custom_links[$i]) && $custom_links[$i] != '') {
$link_start = '<a href="' . $custom_links[$i] . '"' . (!empty($custom_links_target) ? ' target="' . $custom_links_target . '"' : '') . '>';
$link_end = '</a>';
//.........这里部分代码省略.........