PluginProbe
Cool Flipbox – Shortcode & Gutenberg Block / 1.4
Cool Flipbox – Shortcode & Gutenberg Block v1.4
trunk 1.4 1.5 1.6 1.6.2 1.7.1 1.8.3 1.9.0 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1
flip-boxes / flipboxes.php

flipboxes.php in Cool Flipbox – Shortcode & Gutenberg Block 1.4, at flipboxes.php

644 lines 24.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name:Flip Boxes
4 Plugin URI:https://coolplugins.net/
5 Description:Use animated Flip Boxes WordPress plugin to highlight your content inside your page in a great way. Use shortcode to add anywhere.
6 Version:1.4
7 License:GPL2
8 Author:Cool Plugins
9 Author URI:https://coolplugins.net/
10 License URI:https://www.gnu.org/licenses/gpl-2.0.html
11 Domain Path: /languages
12 Text Domain:c-flipboxes
13 */
14 defined( 'ABSPATH' ) or die( "No script kiddies please!" );
15 if( !defined( 'CFB_VERSION' ) ) {
16 define( 'CFB_VERSION', '1.0' );
17 }
18 if( !defined( 'CFB_DIR_PATH' ) ) {
19 define( 'CFB_DIR_PATH', plugin_dir_path( __FILE__ ) );
20 }
21 if( !defined( 'CFB_URL' ) ) {
22 define( 'CFB_URL', plugin_dir_url( __FILE__ ));
23 }
24
25
26 if( !class_exists( 'CflipBoxes' ) )
27 {
28 class CflipBoxes
29 {
30
31 /* Initializes the plugin functions*/
32 function __construct()
33 {
34 if ( file_exists( CFB_DIR_PATH . '/CMB2/init.php' ) ) {
35 require_once CFB_DIR_PATH . '/CMB2/init.php';
36 require_once CFB_DIR_PATH . '/cmb2-fontawesome-picker.php';
37 }
38 add_action('init', array($this,'cfb_register_post_type'));
39 add_action( 'cmb2_admin_init', array($this,'cfb_metaboxes'));
40 add_action( 'cmb2_admin_init', array($this, 'cfb_settings' ));
41 add_shortcode( 'flipboxes',array($this,'cfb_shortcode'));
42 add_action( 'wp_enqueue_scripts',array($this,'cfb_register_frontend_assets')); //registers js and css for frontend
43 add_filter('manage_edit-flipboxes_columns',array($this, 'cfb_add_custom_columns'));
44 add_action('manage_flipboxes_posts_custom_column', array($this, 'cfb_columns_content'), 10, 2 );
45 add_action( 'add_meta_boxes',array($this, 'cfb_shortcode_metabox' ));
46 add_action( 'admin_notices',array($this,'cfb_admin_messages'));
47 add_action( 'wp_ajax_cfb_hideRating',array($this,'cfb_HideRating' ));
48 }
49
50 /**
51 * Activating plugin and adding some info
52 */
53 public static function activate() {
54 update_option("Flip-Boxes-v",CFB_VERSION);
55 update_option("Flip-Boxes-type","FREE");
56 update_option("Flip-Boxes-installDate",date('Y-m-d h:i:s') );
57 update_option("Flip-Boxes-ratingDiv","yes");
58 }
59
60 // END public static function activate
61
62 /**
63 * Deactivate the plugin
64 */
65 public static function deactivate() {
66 // Do nothing
67 }
68
69 // Admin notificaiton for review
70 public function cfb_admin_messages() {
71
72 if( !current_user_can( 'update_plugins' ) ){
73 return;
74 }
75 $install_date = get_option( 'Flip-Boxes-installDate' );
76 $ratingDiv =get_option( 'Flip-Boxes-ratingDiv' )!=false?get_option( 'Flip-Boxes-ratingDiv'):"no";
77
78 $dynamic_msz='<div class="cool_fivestar update-nag" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">'.__('
79 <p>Dear Flip Boxes Plugin User, Hopefully you\'re happy with our plugin. <br> May I ask you to give it a <strong>5-star rating</strong> on WordPress.org ?
80 This will help to spread its popularity and to make this plugin a better one.
81 <br><br>Your help is much appreciated.Thank you very much!').'
82 <ul>
83 <li class="float:left"><a href="https://wordpress.org/support/plugin/flip-boxes/reviews/?filter=5#new-post" class="thankyou button button-primary" target="_new" title="I Like Flipbox" style="color: #ffffff;-webkit-box-shadow: 0 1px 0 #256e34;box-shadow: 0 1px 0 #256e34;font-weight: normal;float:left;margin-right:10px;">'.__('I Like Flip Boxes').'</a></li>
84 <li><a href="javascript:void(0);" class="coolHideRating button" title="I already did" style="">'.__('I already rated it').'</a></li>
85 <li><a href="javascript:void(0);" class="coolHideRating" title="No, not good enough" style="">'.__('No, not good enough, i do not like to rate it!').'</a></li>
86 </ul>
87 </div>
88 <script>
89 jQuery( document ).ready(function( $ ) {
90
91 jQuery(\'.coolHideRating\').click(function(){
92 var data={\'action\':\'cfb_hideRating\'}
93 jQuery.ajax({
94
95 url: "' . admin_url( 'admin-ajax.php' ) . '",
96 type: "post",
97 data: data,
98 dataType: "json",
99 async: !0,
100 success: function(e) {
101 if (e=="success") {
102 jQuery(\'.cool_fivestar\').slideUp(\'fast\');
103
104 }
105 }
106 });
107 })
108
109 });
110 </script>';
111
112 if(get_option( 'Flip-Boxes-installDate' )==false && $ratingDiv== "yes" )
113 {
114 echo $dynamic_msz;
115 }else{
116 $display_date = date( 'Y-m-d h:i:s' );
117 $install_date= new DateTime( $install_date );
118 $current_date = new DateTime( $display_date );
119 $difference = $install_date->diff($current_date);
120 $diff_days= $difference->days;
121 if (isset($diff_days) && $diff_days>=1 && $ratingDiv == "yes" ) {
122 echo $dynamic_msz;
123 }
124 }
125
126 }
127
128 // ajax handler for feedback callback
129 public function cfb_HideRating() {
130 update_option( 'Flip-Boxes-ratingDiv','no' );
131 echo json_encode( array("success") );
132 exit;
133 }
134
135
136 /*Define the metabox and field configurations.*/
137 function cfb_settings()
138 {
139 // Start with an underscore to hide fields from custom fields list
140 $prefix = '_cfb_';
141
142 /*Initiate the metabox*/
143 $flip = new_cmb2_box( array(
144 'id' => 'side-mt',
145 'title' => __( 'Flipbox Settings', 'cmb2' ),
146 'object_types' => array( 'flipboxes', ), // Post type
147 'context' => 'side',
148 'priority' => 'low',
149 'show_names' => true, // Show field names on the left
150 ) );
151
152 // Regular text field
153 $flip->add_field( array(
154 'name' => __( 'Flipbox layout','cmb2' ),
155 'desc' => __( 'Select Flipbox Layout','cmb2' ),
156 'id' => $prefix . 'flip_layout',
157 'type' => 'select',
158 'show_option_none' => false,
159 'default' => 'dashed-with-icon',
160 'options' => array(
161 'dashed-with-icon' => __( 'Layout 1 (Dashed With Icon)', 'cmb2' ),
162 'with-image' => __( 'Layout 2 (With Image)', 'cmb2' ),
163 'solid-with-icon' => __( 'Layout 3 (Solid With Icon)', 'cmb2' ),
164 'layout-4' => __( 'Layout 4', 'cmb2' ),
165 'layout-5' => __( 'Layout 5', 'cmb2' ),
166 'layout-6' => __( 'Layout 6', 'cmb2' ),
167 'layout-7' => __( 'Layout 7', 'cmb2' ),
168 'layout-8' => __( 'Layout 8', 'cmb2' ),
169 'layout-9' => __( 'Layout 9', 'cmb2' ),
170 ),
171 ) );
172
173 $flip->add_field( array(
174 'name' => __( 'Flipbox Effect', 'cmb2' ),
175 'desc' => __( 'Select Flipbox Effect', 'cmb2' ),
176 'id' => $prefix . 'effect',
177 'type' => 'select',
178 'show_option_none' => false,
179 'default' => 'left-to-right',
180 'options' => array(
181 'x' => __( 'Bottom To Top', 'cmb2' ),
182 'y' => __( 'Left To Right', 'cmb2' ),
183 ),
184 ) );
185
186 $flip->add_field( array(
187 'name' => __( 'Number of columns', 'cmb2' ),
188 'desc' => __( 'Select Number of columns', 'cmb2' ),
189 'id' => $prefix . 'column',
190 'type' => 'select',
191 'show_option_none' => false,
192 'default' => 'col-md-4',
193 'options' => array(
194 'col-md-12'=> __( 'One','cmb2' ),
195 'col-md-6' => __( 'Two', 'cmb2' ),
196 'col-md-4' => __( 'Three', 'cmb2' ),
197 'col-md-3' => __( 'Four', 'cmb2' ),
198 'col-md-2' => __( 'Six', 'cmb2' ),
199 ),
200 ) );
201
202 $flip->add_field( array(
203 'name' => __( 'Height', 'cmb2' ),
204 'desc' => __( 'Select height for Flipboxes', 'cmb2' ),
205 'id' => $prefix . 'height',
206 'type' => 'select',
207 'show_option_none' => false,
208 'default' => 'default',
209 'options' => array(
210 'default'=> __( 'Default(according to content)','cmb2' ),
211 'equal' => __( 'Equal height of each Flipbox', 'cmb2' ),
212 ),
213 ) );
214
215 $flip->add_field( array(
216 'name' => __( 'Icon Size(in px)', 'cmb2' ),
217 'desc' => __( 'Enter icon size', 'cmb2' ),
218 'id' => $prefix .'icon_size',
219 'type' => 'text',
220 'default' => '52px',
221 ) );
222
223 $flip->add_field( array(
224 'name' => __( 'Skin Color', 'cmb2' ),
225 'description' => __( 'Choose a skin color', 'cmb2' ),
226 'id' => $prefix .'skin_color',
227 'type' => 'colorpicker',
228 'default' => '#f4bf64',
229 ) );
230
231 $flip->add_field( array(
232 'name' => __( 'Number of Flipboxes', 'cmb2' ),
233 'desc' => __( 'Enter number of flipboxes to show', 'cmb2' ),
234 'id' => $prefix .'no_of_items',
235 'type' => 'text',
236 ) );
237
238 $flip->add_field( array(
239 'name' => __( 'Bootstrap', 'cmb2' ),
240 'id' => $prefix . 'bootstrap',
241 'default' => 'enable',
242 'type' => 'radio',
243 'options' => array(
244 'enable' => __( 'Enable Bootstrap', 'cmb2' ),
245 'disable' =>__( 'Disable Bootstrap', 'cmb2' ),
246 ),
247 ) );
248
249 $flip->add_field( array(
250 'name' =>__( 'Fontawesome', 'cmb2' ),
251 'id' => $prefix . 'font',
252 'default' => 'enable',
253 'type' => 'radio',
254 'options' => array(
255 'enable' =>__( 'Enable Fontawesome', 'cmb2' ),
256 'disable' =>__( 'Disable Fontawesome', 'cmb2' ),
257 ),
258 ) );
259 }
260
261 function cfb_shortcode_metabox()
262 {
263 add_meta_box( 'my-meta-box-id', 'Use This Shortcode',array($this,'cfb_shortcode_text'), 'flipboxes', 'side', 'high' );
264 }
265
266 function cfb_shortcode_text()
267 {
268 $id = get_the_ID();
269 $dynamic_attr='';
270 _e("Paste this shortcode in anywhere (page/post)", "c-flipbox");
271 $dynamic_attr.="[flipboxes id=\"{$id}\"";
272 $dynamic_attr.=']';
273 $prefix="_cfb_";
274 ?>
275 <input type="text" class="regular-small" name="my_meta_box_text" id="my_meta_box_text" value="<?php echo htmlentities ($dynamic_attr);?>" readonly/>
276 <?php
277 }
278 // ADD NEW COLUMN
279 function cfb_add_custom_columns($flip_cols)
280 {
281 $new_columns['cb'] = '<input type="checkbox" />';
282 $new_columns['title'] = _x('Title', 'column name');
283 $new_columns['flip_layout'] = _x('Flipbox Layout', 'flipboxes');
284 $new_columns['effect'] = __('Flipbox Effect','flipboxes');
285 $new_columns['code'] = __('Shortcode','flipboxes');
286 $new_columns['date'] = _x('Sort By Date', 'column name');
287 return $new_columns;
288 }
289
290 function cfb_columns_content($flip_cols,$post)
291 {
292 $prefix="_cfb_";
293 // global $layouts;
294 $layouts=array(
295 'dashed-with-icon' => __( 'Dashed With Icons', 'cmb2' ),
296 'with-image' => __( 'With Image', 'cmb2' ),
297 'solid-with-icon' => __( 'Solid With Icon', 'cmb2' ),
298 'layout-4' => __( 'Layout 4', 'cmb2' ),
299 'layout-5' => __( 'Layout 5', 'cmb2' ),
300 'layout-6' => __( 'Layout 6', 'cmb2' ),
301 'layout-7' => __( 'Layout 7', 'cmb2' ),
302 'layout-8' => __( 'Layout 8', 'cmb2' ),
303 'layout-9' => __( 'Layout 9', 'cmb2' ),
304 );
305 //global $effects;
306 $effects=array(
307 'x' => __( 'Bottom To Top', 'cmb2' ),
308 'y' => __( 'Left To Right', 'cmb2' ),
309 );
310
311 switch ( $flip_cols )
312 {
313 case "flip_layout":
314 $lt = get_post_meta( $post, $prefix . 'flip_layout', true );
315 if(isset($layouts[$lt]))
316 {
317 echo $layouts[$lt];
318 }
319 break;
320 case "effect":
321 $eff= get_post_meta( $post, $prefix . 'effect', true );
322 if(isset($effects[$eff]))
323 {
324 echo $effects[$eff];
325 }
326 break;
327 case "code":
328 global $dynamic_attr;
329 global $id;
330 $dynamic_attr="[flipboxes id=\"{$id}\"]";
331 echo "<input type='text' value='".$dynamic_attr."'>";
332 break;
333 }
334 }
335 function cfb_register_post_type()
336 {
337 $labels = array(
338 'name' => _x( 'Flipboxes', 'Post Type General Name'),
339 'singular_name' => _x( 'Flipboxes', 'Post Type Singular Name'),
340 'menu_name' => __( 'Flipboxes'),
341 'name_admin_bar' => __( 'Flipboxes'),
342 'archives' => __( 'Item Archives'),
343 'attributes' => __( 'Item Attributes'),
344 'parent_item_colon' => __( 'Parent Item:'),
345 'all_items' => __( 'All Flipboxes'),
346 'add_new_item' => __( 'Add New Flipbox'),
347 'add_new' => __( 'Add New'),
348 'new_item' => __( 'New Item'),
349 'edit_item' => __( 'Edit Item'),
350 'update_item' => __( 'Update Item'),
351 'view_item' => __( 'View Item'),
352 'view_items' => __( 'View Items'),
353 'search_items' => __( 'Search Item'),
354 'not_found' => __( 'Not found'),
355 'not_found_in_trash' => __( 'Not found in Trash'),
356 'featured_image' => __( 'Featured Image'),
357 'set_featured_image' => __( 'Set featured image'),
358 'remove_featured_image' => __( 'Remove featured image'),
359 'use_featured_image' => __( 'Use as featured image'),
360 'insert_into_item' => __( 'Insert into item'),
361 'uploaded_to_this_item' => __( 'Uploaded to this item'),
362 'items_list' => __( 'Items list'),
363 'items_list_navigation' => __( 'Items list navigation'),
364 'filter_items_list' => __( 'Filter items list'),
365 );
366 $args = array(
367 'label' => __( 'Flipboxes'),
368 'description' => __( 'Post Type Description'),
369 'labels' => $labels,
370 'supports' => array('title'),
371 'taxonomies' => array(),
372 'hierarchical' => false,
373 'public' => false,
374 'show_ui' => true,
375 'show_in_menu' => true,
376 'menu_position' => 5,
377 'show_in_admin_bar' => true,
378 'show_in_nav_menus' => true,
379 'can_export' => true,
380 'has_archive' => true,
381 'exclude_from_search' => false,
382 'publicly_queryable' => false,
383 'capability_type' => 'page',
384 );
385 register_post_type('flipboxes',$args);
386 }
387
388
389 /*Define the metabox and field configurations*/
390 function cfb_metaboxes()
391 {
392 // Start with an underscore to hide fields from custom fields list
393 $prefix = '_cfb_';
394
395 /* Initiate the metabox*/
396 $flip = new_cmb2_box( array(
397 'id' => 'test_metabox',
398 'title' => __( 'Add Flipboxes', 'cmb2' ),
399 'object_types' => array( 'flipboxes'), // Post type
400 'context' => 'normal',
401 'priority' => 'high',
402 'show_names' => true, // Show field names on the left
403 ) );
404
405
406 $group_field_id = $flip->add_field( array(
407 'id' =>$prefix.'flip_repeat_group',
408 'type' => 'group',
409 'description' => __( '', 'cmb2' ),
410 'options' => array(
411 'group_title' => __( 'Flipbox {#}', 'cmb2' ), // since version 1.1.4, {#} gets replaced by row number
412 'add_button' => __( 'Add Another Flipbox', 'cmb2' ),
413 'remove_button' => __( 'Remove Flipbox', 'cmb2' ),
414 'sortable' => true, // beta
415 ),
416 ) );
417
418 // Id's for group's fields only need to be unique for the group. Prefix is not needed.
419 $flip->add_group_field( $group_field_id, array(
420 'name' => __('Title','c-flipbox'),
421 'description' => __('Enter a title for this Flipbox','c-flipbox'),
422 'id' => 'flipbox_title',
423 'type' => 'text',
424 ) );
425
426 $flip->add_group_field( $group_field_id, array(
427 'name' => __('Front Description','c-flipbox'),
428 'id' => 'flipbox_label',
429 'description' => __('Add Front Description for this Flipbox','c-flipbox'),
430 'type' => 'textarea_small',
431 ) );
432
433 $flip->add_group_field( $group_field_id, array(
434 'name' => __('Back Description','c-flipbox'),
435 'description' => __('Recomended : One Line Description','c-flipbox'),
436 'id' => 'flipbox_desc',
437 'type' => 'textarea_small',
438 ) );
439
440 $flip->add_group_field( $group_field_id, array(
441 'name' => __( 'Description Length', 'c-flipbox' ),
442 'description' => __('Enter number of characters','c-flipbox'),
443 'id' => 'flipbox_desc_length',
444 'type' => 'text',
445 'default' => '75',
446 ) );
447
448 $flip->add_group_field( $group_field_id, array(
449 'name' => __( 'Select Icon', 'c-flipbox' ),
450 'description' => __('Choose an Icon for Flipbox Layout','c-flipbox'),
451 'id' => 'flipbox_icon',
452 'type' => 'fontawesome_icon',
453 ) );
454 $flip->add_group_field( $group_field_id, array(
455 'name' => __( 'Color Scheme', 'c-flipbox' ),
456 'description' => __('Choose Color Scheme','c-flipbox'),
457 'id' => 'color_scheme',
458 'type' => 'colorpicker',
459 ) );
460
461 $flip->add_group_field( $group_field_id, array(
462 'name' => __('Image','c-flipbox'),
463 'id' => 'flipbox_image',
464 'description' => __('Upload an Image for "with-image" Flipbox Layout','c-flipbox'),
465 'type' => 'file',
466 ) );
467
468 $flip->add_group_field( $group_field_id, array(
469 'name' => __('URL','c-flipbox'),
470 'id' => 'flipbox_url',
471 'description' => __('Enter URL for this Flipbox','c-flipbox'),
472 'type' => 'text_url',
473 'protocols' => array('http', 'https'),
474 ) );
475
476
477 $flip->add_group_field( $group_field_id, array(
478 'name' => __('URL Text','c-flipbox'),
479 'id' => 'read_more_link',
480 'description' => __('Enter Text For Link','c-flipbox'),
481 'type' => 'text',
482 ) );
483 }
484 function cfb_register_frontend_assets()
485 {
486 wp_register_script( 'flipbox-js', CFB_URL . 'assets/js/flipbox.min.js', array('jquery'), CFB_VERSION );
487 wp_register_script( 'flipboxes-layout-js', CFB_URL . 'assets/js/flipboxes-layout.min.js', array('jquery'), CFB_VERSION );
488
489 wp_register_style( 'cfb-fontawesome',CFB_URL . 'assets/css/font-awesome.min.css', array(), CFB_VERSION);
490
491 wp_register_style( 'flipstyle',CFB_URL . 'assets/css/flipboxes.css', array(), CFB_VERSION);
492 wp_register_style( 'flip-layout-style',CFB_URL . 'assets/css/flipboxes-layout.min.css', array(), CFB_VERSION);
493
494 wp_register_style( 'cfb-bootstrap',CFB_URL . 'assets/css/bootstrap.min.css', array(), CFB_VERSION ,'all');
495
496 wp_register_script( 'flip-min-js', CFB_URL . 'assets/js/jquery.flip.min.js', array('jquery'), CFB_VERSION );
497
498
499 }
500
501 function cfb_shortcode($atts)
502 {
503 extract( shortcode_atts( array (
504 'id' => '',
505 ), $atts ));
506 $prefix = "_cfb_";
507 $title = get_the_title($id);
508 $flip_layout = get_post_meta( $id, $prefix . 'flip_layout', true );
509 $effect = get_post_meta( $id, $prefix . 'effect', true );
510 $height = get_post_meta( $id, $prefix . 'height', true );
511 $height= $height!=""?$height:'default';
512
513 $iconsize = get_post_meta( $id, $prefix .'icon_size', true );
514 $icon_size=isset($iconsize )&&!empty($iconsize)?$iconsize:"52px";
515 $skincolor= get_post_meta( $id, $prefix .'skin_color', true );
516 $skincolor=isset($skincolor)&& !empty($skincolor)?$skincolor:"#f4bf64";
517
518 $cols= get_post_meta( $id, $prefix . 'column', true );
519 $bootstrap = get_post_meta( $id, $prefix . 'bootstrap', true );
520 $fontawesome= get_post_meta( $id, $prefix . 'font', true );
521 $noitems = get_post_meta( $id, $prefix . 'no_of_items', true );
522 $no_of_items = isset($noitems)&& !empty($noitems)?$noitems:9999;
523 $entries = get_post_meta( $id, $prefix .'flip_repeat_group', true );
524
525
526 global $post;
527 if(isset($post->post_content) && has_shortcode( $post->post_content, 'flipboxes'))
528 {
529 //Enqueue common required assets
530 if ($flip_layout=="dashed-with-icon" || $flip_layout=="with-image" || $flip_layout=="solid-with-icon"){
531
532 wp_enqueue_style( 'flipstyle');
533
534 wp_enqueue_script( 'flipbox-js');
535 }
536 else{
537 wp_enqueue_style( 'flip-layout-style');
538 wp_enqueue_script( 'flipboxes-layout-js');
539 }
540 wp_enqueue_script( 'flip-min-js');
541
542 }
543
544 if ($bootstrap=='enable')
545 {
546 wp_enqueue_style( 'cfb-bootstrap');
547 }
548 if ($fontawesome=='enable')
549 {
550 wp_enqueue_style( 'cfb-fontawesome');
551 }
552
553
554 if( is_array( $entries ) && count($entries)>-1 )
555 {
556 $i=1;
557 $flipbox_html = '';
558
559 $flipbox_html .='<div id="flipbox-widget-'.$id.'" class="cfb_wrapper '.$flip_layout.'">';
560 foreach ( $entries as $entry )
561 {
562
563 if($i>$no_of_items){
564 break;
565 }
566
567 $flipbox_title =isset($entry['flipbox_title'])?$entry ['flipbox_title']:'';
568 $flipbox_desc =isset($entry['flipbox_desc'])?$entry['flipbox_desc']:'';
569 $flipbox_desc_length =isset($entry['flipbox_desc_length'])?$entry ['flipbox_desc_length']:'75';
570 $flipbox_truncate =mb_strimwidth($flipbox_desc ,0,$flipbox_desc_length,"...");
571 $single_f_c =isset($entry['color_scheme'])?$entry['color_scheme']:"";
572 $flipbox_icon =isset($entry['flipbox_icon'])?$entry['flipbox_icon']:'';
573 $flipbox_image =isset($entry['flipbox_image'])?$entry['flipbox_image']:'';
574 $flipbox_url =isset($entry['flipbox_url'])?$entry['flipbox_url']:'';
575 $back_desc =isset($entry['flipbox_label'])?$entry['flipbox_label']:'';
576 $flipbox_label =mb_strimwidth($back_desc ,0,$flipbox_desc_length,"...");
577 $read_more_link =isset($entry['read_more_link'])?$entry['read_more_link']:'';
578
579
580 if($single_f_c!==""){
581 $flipbox_color_scheme=$single_f_c;
582 }else{
583 $flipbox_color_scheme=$skincolor;
584 }
585
586 if ($flip_layout=="dashed-with-icon"){
587
588 require dirname(__FILE__) . '/layouts/layout-1.php';
589
590 $flipbox_html .= $layout_html;
591 }
592 elseif ($flip_layout=="with-image"){
593 require(dirname(__FILE__) . '/layouts/layout-2.php');
594 $flipbox_html .= $layout_html;
595 }
596 elseif ($flip_layout=="solid-with-icon"){
597 require(dirname(__FILE__) . '/layouts/layout-3.php');
598 $flipbox_html .= $layout_html;
599 }
600 elseif ($flip_layout=="layout-4"){
601 require(dirname(__FILE__) . '/layouts/layout-4.php');
602 $flipbox_html .= $layout_html;
603 }
604 elseif ($flip_layout=="layout-5"){
605 require(dirname(__FILE__) . '/layouts/layout-5.php');
606 $flipbox_html .= $layout_html;
607 }
608 elseif ($flip_layout=="layout-6"){
609 require(dirname(__FILE__) . '/layouts/layout-6.php');
610 $flipbox_html .= $layout_html;
611 }
612 elseif ($flip_layout=="layout-7"){
613 require(dirname(__FILE__) . '/layouts/layout-7.php');
614 $flipbox_html .= $layout_html;
615 }
616 elseif ($flip_layout=="layout-8"){
617 require(dirname(__FILE__) . '/layouts/layout-8.php');
618 $flipbox_html .= $layout_html;
619 }
620 elseif ($flip_layout=="layout-9"){
621 require(dirname(__FILE__) . '/layouts/layout-9.php');
622 $flipbox_html .= $layout_html;
623 }
624
625
626 $i++;
627 } // end of foreach
628 $flipbox_html .='</div>';
629 return $flipbox_html;
630 }else{
631 return __('No flipbox content added','c-flipboxes');
632 }
633
634
635 }
636
637 }// end class
638 }
639 // Installation and uninstallation hooks
640 register_activation_hook(__FILE__, array('CflipBoxes', 'activate'));
641 register_deactivation_hook(__FILE__, array('CflipBoxes', 'deactivate'));
642
643 $CflipBoxes_obj = new CflipBoxes(); //initialization of plugin
644