'upload_label' => __( 'Upload Image', 'publisher' ),
'remove_label' => __( 'Remove', 'publisher' ),
'media_title' => __( 'Remove', 'publisher' ),
'type' => 'bf_media_image',
//
'vc_admin_label' => false,
),
array(
'name' => __( 'Message', 'publisher' ),
'type' => 'textarea',
'id' => 'msg',
//
'vc_admin_label' => false,
),
array(
'section_class' => 'style-floated-left bordered bf-css-edit-switch',
'name' => __( 'Show Powered By?', 'publisher' ),
'id' => 'show-powered',
'type' => 'switch',
//
'vc_admin_label' => false,
),
);
/**
* Retrieve heading fields from outside (our themes are defining them)
*/
{
$heading_fields = apply_filters( 'better-framework/shortcodes/heading-fields', array(), $this->id );
if ( $heading_fields ) {
$fields = array_merge( $fields, $heading_fields );
}
}
/**
* Retrieve design fields from outside (our themes are defining them)
*/
{
$design_fields = apply_filters( 'better-framework/shortcodes/design-fields', array(), $this->id );
if ( $design_fields ) {
$fields = array_merge( $fields, $design_fields );
}
}
bf_array_insert_after(
'bs-show-phone',
$fields,
'bs-text-color-scheme',
array(
'name' => __( 'Block Text Color Scheme', 'publisher' ),
'id' => 'bs-text-color-scheme',
//
'type' => 'select',
'options' => array(
'' => __( '-- Default --', 'publisher' ),
'light' => __( 'White Color Texts', 'publisher' ),
),
//
'vc_admin_label' => false,
)
);
return $fields;
}
/**
* Registers Page Builder Add-on
*/
function page_builder_settings() {
$settings = parent::page_builder_settings();
return array_merge( $settings, array(
'name' => __( 'Newsletter - MailChimp', 'publisher' ),
"id" => $this->id,
"weight" => 10,
"wrapper_height" => 'full',
"category" => publisher_white_label_get_option( 'publisher' ),
'icon_url' => PUBLISHER_THEME_URI . 'images/shortcodes/bs-newsletter-mailchimp.png',
) );
} // page_builder_settings
function tinymce_settings() {
return array(
'name' => __( 'Newsletter - MailChimp', 'publisher' ),
);
}
}
class Publisher_Newsletter_MailChimp_Widget extends BF_Widget {
/**
* Register widget with WordPress.
*/
function __construct() {
parent::__construct(
'bs-newsletter-mailchimp',
sprintf( __( '%s - Newsletter - MailChimp', 'publisher' ), publisher_white_label_get_option( 'publisher' ) ),
array(
'description' => __( 'MailChimp newsletter signup form widget.', 'publisher' )
)
);
}
/**
* Adds backend fields
*/
function load_fields() {
$this->fields = array(
array(
'name' => __( 'Instructions', 'publisher' ),
'id' => 'help',
'type' => 'info',
'std' => wp_kses(
sprintf(
__( 'To integrate MailChimp with your Publisher site, you will need MailChimp signup form code that you can find it with following steps:
- Log in to your MailChimp account.
- From your account Dashboard, click Lists in the navigation menu.
- Find the list you want to connect to your site, click on it.
- Find the "Sign up forms" from the list navigation, click on it.
- Click "Select" on the "Embedded" forms option.
- Find the "Copy/paste onto your site" section.
- Click anywhere in the box to select the code.
- Press "ctrl + C" on a PC or "command + C" on a Mac to copy the code.
- Paste it in following "MailChimp Form Code" field.
', 'publisher' )
,
'https://goo.gl/MU6UWn'
), bf_trans_allowed_html()
),
'state' => 'open',
'info-type' => 'help',
),
array(
'name' => __( 'Title', 'publisher' ),
'id' => 'title',
'type' => 'text',
),
array(
'name' => __( 'MailChimp Form Code', 'publisher' ),
'id' => 'mailchimp-code',
'type' => 'textarea',
'container_class' => 'widget-mailchimp-code-field',
),
array(
'name' => __( 'MailChimp URL', 'publisher' ),
'id' => 'mailchimp-url',
'type' => 'text',
'container_class' => 'widget-mailchimp-url-field',
),
array(
'name' => __( 'Image', 'publisher' ),
'id' => 'image',
'type' => 'media_image',
'upload_label' => __( 'Upload Image', 'publisher' ),
'remove_label' => __( 'Remove', 'publisher' ),
'media_title' => __( 'Remove', 'publisher' ),
'media_button' => __( 'Select Image', 'publisher' ),
),
array(
'name' => __( 'Message', 'publisher' ),
'id' => 'msg',
'type' => 'textarea',
),
array(
'name' => __( 'Show Powered By?', 'publisher' ),
'id' => 'show-powered',
'type' => 'switch',
),
);
}
}
t --', 'publisher' ),
'light' => __( 'White Color Texts', 'publisher' ),
),
//
'vc_admin_label' => false,
)
);
return $fields;
}
/**
* Registers Page Builder Add-on
*/
function page_builder_settings() {
$settings = parent::page_builder_settings();
return array_merge( $settings, array(
'name' => __( 'Flickr Photos', 'publisher' ),
"id" => $this->id,
"weight" => 10,
"wrapper_height" => 'full',
'icon_url' => PUBLISHER_THEME_URI . 'images/shortcodes/bs-flickr.png',
"category" => publisher_white_label_get_option( 'publisher' ),
) );
} // page_builder_settings
function tinymce_settings() {
return array(
'name' => __( 'Flickr Photos', 'publisher' ),
);
}
} // Publisher_Flickr_Shortcode
if ( ! function_exists( 'publisher_shortcode_flickr_get_data' ) ) {
/**
* Wrapper ro getting Flickr data with cache mechanism
*
* @param $atts
*
* @return array|bool|mixed|void
*/
function publisher_shortcode_flickr_get_data( $atts ) {
$data_store = 'bs-fk-' . $atts['user_id'];
$back_store = 'bs-fk-bk-' . $atts['user_id'];
$cache_time = HOUR_IN_SECONDS * 6;
if ( ( $images_list = get_transient( $data_store ) ) === false ) {
$images_list = publisher_shortcode_flickr_fetch_data( $atts );
if ( is_wp_error( $images_list ) && is_user_logged_in() ) {
return $images_list;
} elseif ( ! is_wp_error( $images_list ) ) {
// Save a transient to expire in $cache_time and a permanent backup option ( fallback )
set_transient( $data_store, $images_list, $cache_time );
update_option( $back_store, $images_list, 'no' );
} // Fall to permanent backup store
else {
$images_list = get_option( $back_store );
}
}
return $images_list;
} // publisher_shortcode_flickr_get_data
} // if
if ( ! function_exists( 'publisher_shortcode_flickr_fetch_data' ) ) {
/**
* Retrieve Flickr fresh data
*
* @param $atts
*
* @return array|bool
*/
function publisher_shortcode_flickr_fetch_data( $atts ) {
$remote_response = wp_remote_get( 'http://api.flickr.com/services/feeds/photos_public.gne?format=json&id=' . urlencode( $atts['user_id'] ) . '&nojsoncallback=1&tags=' . urlencode( $atts['tags'] ) );
if ( is_wp_error( $remote_response ) || 200 != wp_remote_retrieve_response_code( $remote_response ) ) {
return new WP_Error( 'invalid_response', __( 'Flickr did not return a 200.', 'publisher' ) );
}
// Fix Flickr JSON escape bug
$remote_body = wp_remote_retrieve_body( $remote_response );
$remote_body = str_replace( "\\'", "'", $remote_body );
$json = json_decode( $remote_body, true );
if ( ! is_array( $json ) ) {
return new WP_Error( 'bad_array', __( 'Flickr has returned invalid data.', 'publisher' ) );
}
$images_list = $json['items'];
// Replace medium with small square image
foreach ( $images_list as $key => $item ) {
$images_list[ $key ]['media']['xs'] = preg_replace( '/_m\.(jp?g|png|gif)$/', '_s.\\1', $item['media']['m'] );
$images_list[ $key ]['media']['s'] = preg_replace( '/_m\.(jp?g|png|gif)$/', '_q_d.\\1', $item['media']['m'] );
}
return $images_list;
} // publisher_shortcode_flickr_fetch_data
} // if
/**
* Publisher Flickr Widget
*/
class Publisher_Flickr_Widget extends BF_Widget {
/**
* Register widget with WordPress.
*/
function __construct() {
parent::__construct(
'bs-flickr',
sprintf( __( '%s - Flickr', 'publisher' ), publisher_white_label_get_option( 'publisher' ) ),
array(
'desc' => __( 'Display latest photos from Flickr.', 'publisher' )
)
);
}
/**
* Adds backend fields
*/
function load_fields() {
// Back end form fields
$this->fields = array(
array(
'name' => __( 'Instructions', 'publisher' ),
'id' => 'help',
'type' => 'info',
'std' => wp_kses( sprintf( __( 'You need to get the user id from your Flickr account.
- Attain your user id using this tool
- Copy the user id
- Paste it in the "Flickr ID" input box below
', 'publisher' ), 'http://goo.gl/pHx7LV' ), bf_trans_allowed_html() ),
'state' => 'open',
'info-type' => 'help',
),
array(
'name' => __( 'Title:', 'publisher' ),
'id' => 'title',
'type' => 'text',
),
array(
'name' => __( 'Flickr ID:', 'publisher' ),
'id' => 'user_id',
'type' => 'text',
),
array(
'name' => __( 'Columns', 'publisher' ),
'id' => 'style',
'type' => 'select',
'options' => array(
2 => __( '2 Column', 'publisher' ),
3 => __( '3 Column', 'publisher' ),
'slider' => __( 'Slider', 'publisher' ),
),
),
array(
'name' => __( 'Number of Photos:', 'publisher' ),
'id' => 'photo_count',
'type' => 'text',
),
array(
'name' => __( 'Tags (comma separated, optional):', 'publisher' ),
'id' => 'tags',
'type' => 'text',
),
);
}
}
Assomption 2024 - JusteInfos- Information générale