Skip to content

Commit

Permalink
Merged development.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThierryA committed Apr 28, 2016
2 parents 60c7606 + 1adbbcb commit ccda99b
Show file tree
Hide file tree
Showing 53 changed files with 513 additions and 284 deletions.
16 changes: 8 additions & 8 deletions lib/admin/assets/js/wp-customize-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@

viewportWidth: function() {

if ( wp.customize.value('beans_enable_viewport_width')() == true )
this.wpIframe.css( 'width', wp.customize.value('beans_viewport_width')() );
if ( wp.customize.value( 'beans_enable_viewport_width' )() == true )
this.wpIframe.css( 'width', wp.customize.value( 'beans_viewport_width' )() );
else
this.wpIframe.css( 'width', '100%' );

},
viewportHeight: function() {

if ( wp.customize.value('beans_enable_viewport_height')() == true )
this.wpIframe.css( 'height', wp.customize.value('beans_viewport_height')() );
if ( wp.customize.value( 'beans_enable_viewport_height' )() == true )
this.wpIframe.css( 'height', wp.customize.value( 'beans_viewport_height' )() );
else
this.wpIframe.css( 'height', '100%' );

Expand All @@ -49,22 +49,22 @@
var that = this;

// Fire viewport width.
wp.customize.value( 'beans_enable_viewport_width').bind( function( to ) {
wp.customize.value( 'beans_enable_viewport_width' ).bind( function( to ) {
that.viewportWidth();
} );

// Fire viewport width.
wp.customize.value( 'beans_viewport_width').bind( function( to ) {
wp.customize.value( 'beans_viewport_width' ).bind( function( to ) {
that.viewportWidth();
} );

// Fire viewport height.
wp.customize.value( 'beans_enable_viewport_height').bind( function( to ) {
wp.customize.value( 'beans_enable_viewport_height' ).bind( function( to ) {
that.viewportHeight();
} );

// Fire viewport height.
wp.customize.value( 'beans_viewport_height').bind( function( to ) {
wp.customize.value( 'beans_viewport_height' ).bind( function( to ) {
that.viewportHeight();
} );

Expand Down
35 changes: 19 additions & 16 deletions lib/api/compiler/class-compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ public function set_fragments() {
if ( $added_fragments = beans_get( $this->compiler['id'], $_beans_compiler_added_fragments[$this->compiler['format']] ) )
$this->compiler['fragments'] = array_merge( $this->compiler['fragments'], $added_fragments );

/**
* Filter the compiler fragment files.
*
* The dynamic portion of the hook name, $this->compiler['id'], refers to the compiler id used as a reference.
*
* @since 1.0.0
*
* @param array $fragments An array of fragment files.
*/
$this->compiler['fragments'] = apply_filters( 'beans_compiler_fragments_' . $this->compiler['id'], $this->compiler['fragments'] );

}
Expand Down Expand Up @@ -247,7 +256,7 @@ public function get_url() {
$url = trailingslashit( $this->url ) . beans_get( 'filename', $this->compiler );

if ( is_ssl() )
$url = str_replace('http://', 'https://', $url );
$url = str_replace( 'http://', 'https://', $url );

return $url;

Expand Down Expand Up @@ -275,7 +284,7 @@ public function combine_fragments() {

$content = '';

// Looo through fragments.
// Loop through fragments.
foreach ( $this->compiler['fragments'] as $fragment ) {

// Stop here if the fragment is empty.
Expand Down Expand Up @@ -312,16 +321,10 @@ public function combine_fragments() {
$get_content = $this->replace_css_url( $get_content );
$get_content = $this->add_content_media_query( $get_content );

// Add content wrapped in the media query if set.
$content .= $get_content;

} else {

// Prevent js conflicts.
$content .= "\n\n" . ";" . $get_content;

}

$content .= ( $content ? "\n\n" : '' ) . $get_content;

}

return $this->format_content( $content );
Expand Down Expand Up @@ -565,23 +568,23 @@ public function kill() {

$html = beans_output( 'beans_compiler_error_title_text', sprintf(
'<h2>%s</h2>',
__( 'Not cool, Beans cannot work its magic :(', 'beans' )
__( 'Not cool, Beans cannot work its magic :(', 'tm-beans' )
) );

$html .= beans_output( 'beans_compiler_error_message_text', sprintf(
'<p>%s</p>',
__( 'Your current install or file permission prevents Beans from working its magic. Please get in touch with Beans support, we will gladly get you started within 24 - 48 hours (working days).', 'beans' )
__( 'Your current install or file permission prevents Beans from working its magic. Please get in touch with Beans support, we will gladly get you started within 24 - 48 hours (working days).', 'tm-beans' )
) );

$html .= beans_output( 'beans_compiler_error_contact_text', sprintf(
'<a class="button" href="http://www.getbeans.io/contact/?compiler_report=1" target="_blanc">%s</a>',
__( 'Contact Beans Support', 'beans' )
__( 'Contact Beans Support', 'tm-beans' )
) );

$html .= beans_output( 'beans_compiler_error_report_text', sprintf(
'<p style="margin-top: 12px; font-size: 12px;"><a href="' . add_query_arg( 'beans_send_compiler_report', true ) . '">%1$s</a>. %2$s</p>',
__( 'Send us an automatic report', 'beans' ),
__( 'We respect your time and understand you might not be able to contact us.', 'beans' )
__( 'Send us an automatic report', 'tm-beans' ),
__( 'We respect your time and understand you might not be able to contact us.', 'tm-beans' )
) );

wp_die( $html );
Expand Down Expand Up @@ -611,7 +614,7 @@ public function report() {
// Die and display message.
wp_die( beans_output( 'beans_compiler_report_error_text', sprintf(
'<p>%s<p>',
__( 'Thanks for your contribution by reporting this issue. We hope to hear from you again.', 'beans' )
__( 'Thanks for your contribution by reporting this issue. We hope to hear from you again.', 'tm-beans' )
) ) );

}
Expand Down
4 changes: 2 additions & 2 deletions lib/api/compiler/class-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public function register() {
'default' => array( 'aggressive' ),
'attributes' => array( 'style' => 'margin: -3px 0 0 -8px;' ),
'options' => array(
'aggressive' => 'Aggressive',
'standard' => 'Standard'
'aggressive' => __( 'Aggressive', 'tm-beans' ),
'standard' => __( 'Standard', 'tm-beans' )
)
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/api/compiler/class-page-compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private function compile_enqueued( $type, $depedencies = false ) {
if ( $args->args != 'all' )
$args->src = add_query_arg( array( 'beans_compiler_media_query' => $args->args ), $args->src );

wp_dequeue_style( $id );
$$set_global->done[] = $id;

} elseif ( $type == 'script' ) {

Expand Down Expand Up @@ -135,7 +135,7 @@ public function dequeue_scripts() {
if ( isset( $args->extra['data'] ) )
$localized .= $args->extra['data'] . "\n";

wp_dequeue_script( $id );
$wp_scripts->done[] = $id;

}

Expand Down
3 changes: 1 addition & 2 deletions lib/api/compiler/vendors/gzip.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
$gzip = false;

if ( $gzip )
ob_start('ob_gzhandler');

ob_start( 'ob_gzhandler' );

// Include file.
if ( ( $id = $_GET['id'] ) && ( $file = $_GET['file'] ) && ( $type = $_GET['type'] ) ) {
Expand Down
1 change: 0 additions & 1 deletion lib/api/compiler/vendors/lessc.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,6 @@ protected function compileProp($prop, $block, $out) {
$mixins = $this->findBlocks($block, $path, $orderedArgs, $keywordArgs);

if ($mixins === null) {
// fwrite(STDERR,"failed to find block: ".implode(" > ", $path)."\n");
break; // throw error here??
}

Expand Down
1 change: 0 additions & 1 deletion lib/api/fields/assets/css/fields.css
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@
}



/* Options fields modifiers
========================================================================== */
.bs-options-form-actions {
Expand Down
6 changes: 3 additions & 3 deletions lib/api/fields/assets/js/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@
// Run a callback when an image is selected.
media_iframe.on( 'select', function() {

var selection = media_iframe.state().get('selection');
var selection = media_iframe.state().get( 'selection' );

if ( !selection )
return;

selection.each( function( attachment ) {

// Clone the the template field.
var newField = field.find('.bs-image-wrap.bs-image-template')
var newField = field.find( '.bs-image-wrap.bs-image-template' )
.clone()
.removeClass( 'bs-image-template' );

var updatedfield = $this.updateImage( newField, attachment );

// Finally append the field
field.find('.bs-images-wrap').append( updatedfield );
field.find( '.bs-images-wrap' ).append( updatedfield );

// Hide the button if multiple images are not permissible.
if ( !$this.isMultiple )
Expand Down
9 changes: 4 additions & 5 deletions lib/api/fields/types/activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
*/
function beans_field_activation( $field ) {

$checked = $field['value'] ? ' checked="checked"' : null;

echo '<input type="hidden" value="0" name="' . $field['name'] . '" />';

echo '<input type="checkbox" name="' . $field['name'] . '" value="1" ' . $checked . ' ' . beans_sanatize_attributes( $field['attributes'] ) . ' />';
?>
<input type="hidden" value="0" name="<?php echo esc_attr( $field['name'] ); ?>" />
<input type="checkbox" name="<?php echo esc_attr( $field['name'] ); ?>" value="1" <?php checked( $field['value'], 1 ); ?> <?php echo beans_esc_attributes( $field['attributes'] ); ?>/>
<?php

}
14 changes: 6 additions & 8 deletions lib/api/fields/types/checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
*/
function beans_field_checkbox( $field ) {

$checked = $field['value'] ? ' checked="checked"' : null;

echo '<input type="hidden" value="0" name="' . $field['name'] . '" />';

echo '<input type="checkbox" name="' . $field['name'] . '" value="1" ' . $checked . ' ' . beans_sanatize_attributes( $field['attributes'] ) . ' />';

if ( $checkbox_label = beans_get( 'checkbox_label', $field, 'Enable' ) )
echo '<span class="bs-checkbox-label">' . $checkbox_label . '</span>';
?>
<input type="hidden" value="0" name="<?php echo esc_attr( $field['name'] ); ?>" />
<input type="checkbox" name="<?php echo esc_attr( $field['name'] ); ?>" value="1" <?php checked( $field['value'], 1 ); ?> <?php echo beans_esc_attributes( $field['attributes'] ); ?>/>
<?php if ( $checkbox_label = beans_get( 'checkbox_label', $field, __( 'Enable', 'tm-beans' ) ) ) : ?>
<span class="bs-checkbox-label"><?php echo $checkbox_label; ?></span>
<?php endif;

}
6 changes: 4 additions & 2 deletions lib/api/fields/types/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ function beans_field_description( $field ) {

if ( isset( $extended ) ) {

echo '<br /><a class="bs-read-more" href="#">' . __( 'More...', 'tm-beans' ) . '</a>';
echo '<div class="bs-extended-content">' . $extended . '</div>';
?>
<br /><a class="bs-read-more" href="#"><?php _e( 'More...', 'tm-beans' ); ?></a>
<div class="bs-extended-content"><?php echo $extended; ?></div>
<?php

}

Expand Down
51 changes: 21 additions & 30 deletions lib/api/fields/types/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,11 @@ function beans_field_image( $field ) {
// Hide beans if it is a single image and an image already exists
$hide = !$multiple && is_numeric( $field['value'] ) ? 'style="display: none"' : '';

echo '<a href="#" class="bs-add-image button button-small" ' . $hide . '>';
echo _n( 'Add Image', 'Add Images', ( $multiple ? 2 : 1 ), 'tm-beans' );
echo '</a>';

echo '<input type="hidden" name="' . $field['name'] . '" value="">';

echo '<div class="bs-images-wrap" data-multiple="' . $multiple . '">';

foreach ( $images as $id ) {
?>
<a href="#" class="bs-add-image button button-small" <?php echo $hide; ?>><?php echo _n( 'Add Image', 'Add Images', ( $multiple ? 2 : 1 ), 'tm-beans' ); ?></a>
<input type="hidden" name="<?php echo esc_attr( $field['name'] ); ?>" value="">
<div class="bs-images-wrap" data-multiple="<?php echo esc_attr( $multiple ); ?>">
<?php foreach ( $images as $id ) :

// Stop here if the id is false.
if ( !$id )
Expand All @@ -80,26 +76,21 @@ function beans_field_image( $field ) {

}

echo '<div class="bs-image-wrap ' . $class . '">';

echo '<input ' . beans_sanatize_attributes( $attributes ) . ' />';

echo '<img src="' . beans_get( 0, $img ) . '">';

echo '<div class="bs-toolbar">';

if ( $multiple )
echo '<a href="#" class="dashicons dashicons-menu"></a>';

echo '<a href="#" class="dashicons dashicons-edit"></a>';
echo '<a href="#" class="dashicons dashicons-post-trash"></a>';

echo '</div>';

echo '</div>';

}

echo '</div>';
?>
<div class="bs-image-wrap <?php echo esc_attr( $class ); ?>">
<input <?php echo beans_esc_attributes( $attributes ); ?>/>
<img src="<?php echo esc_url( beans_get( 0, $img ) ); ?>">
<div class="bs-toolbar">
<?php if ( $multiple ) : ?>
<a href="#" class="dashicons dashicons-menu"></a>
<?php endif; ?>
<a href="#" class="dashicons dashicons-edit"></a>
<a href="#" class="dashicons dashicons-post-trash"></a>
</div>
</div>

<?php endforeach; ?>
</div>
<?php

}
36 changes: 15 additions & 21 deletions lib/api/fields/types/radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,24 @@ function beans_field_radio( $field ) {

$field['default'] = isset( $checkbox['default'] ) ? $checkbox['default'] : key( $field['options'] );

echo '<fieldset>';
?>
<fieldset>
<?php $i = 0; foreach ( $field['options'] as $id => $radio ) :

$i = 0; foreach ( $field['options'] as $id => $radio ) {

$checked = ( $id == $field['value'] ) ? ' checked="checked"' : null;
$extensions = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' );
$has_image = in_array( beans_get( 'extension', pathinfo( $radio ) ), $extensions ) ? 'bs-has-image' : false;

echo '<label class="' . $has_image . '">';

if ( $has_image )
echo '<img src="' . $radio . '" />';

echo '<input type="radio" name="' . $field['name'] . '" value="' . $id . '" ' . $checked . ' ' . beans_sanatize_attributes( $field['attributes'] ) . '/>';

if ( !$has_image )
echo $radio;

echo '</label>';

$i++;

}

echo '</fieldset>';
?>
<label class="<?php echo esc_attr( $has_image ); ?>">
<?php if ( $has_image ) : ?>
<img src="<?php echo esc_url( $radio ); ?>"/>
<?php endif; ?>
<input type="radio" name="<?php echo esc_attr( $field['name'] ); ?>" value="<?php echo esc_attr( $id ); ?>" <?php checked( $id, $field['value'], 1 ); ?> <?php echo beans_esc_attributes( $field['attributes'] ); ?>/>
<?php if ( !$has_image ) echo $radio; ?>
</label>

<?php $i++; endforeach; ?>
</fieldset>
<?php

}
Loading

0 comments on commit ccda99b

Please sign in to comment.