Current File : /home/kelaby89/sergio-cuchi.tattoo/wp-content/plugins/maori-features/so-widgets.php
<?php
/* ----------------------------------------------------------
Add Widget Collection
------------------------------------------------------------- */
function add_maori_widgets_collection($folders){
	$folders[] = plugin_dir_path(__FILE__).'so-widgets/';
	return $folders;
}
add_filter('siteorigin_widgets_widget_folders', 'add_maori_widgets_collection');

/* ----------------------------------------------------------
Widget Groups
------------------------------------------------------------- */
function maori_add_widget_tabs($tabs) {
    $tabs[] = array(
        'title' => esc_html__('Maori Widgets', 'maori'),
        'filter' => array(
            'groups' => array('maori')
        )
    );
    return $tabs;
}
add_filter('siteorigin_panels_widget_dialog_tabs', 'maori_add_widget_tabs', 20);

/* ----------------------------------------------------------
Activate Widgets
------------------------------------------------------------- */
function maori_filter_active_widgets($active){
    $active['maori-headline'] = true;
    $active['maori-img-slider'] = true;
    $active['maori-carousel'] = true;
    $active['maori-accordion'] = true;
    $active['maori-tabs'] = true;
    $active['maori-divider'] = true;
    $active['maori-posts'] = true;
    $active['maori-list'] = true;
    $active['maori-testimonials'] = true;
    $active['maori-features'] = true;
    /* Siteorigin Widgets */
    $active['features'] = true;
    $active['social-media-buttons'] = true;
    return $active;
}
add_filter('siteorigin_widgets_active_widgets', 'maori_filter_active_widgets');

/* ----------------------------------------------------------
Custom Class Prefix
------------------------------------------------------------- */
function maori_fields_class_prefixes( $class_prefixes ) {
    $class_prefixes[] = 'maori_';
    return $class_prefixes;
}
add_filter( 'siteorigin_widgets_field_class_prefixes', 'maori_fields_class_prefixes' );


/* ----------------------------------------------------------
Add Custom Row Field
------------------------------------------------------------- */
function maori_row_style_fields($fields) {
    $fields['maoripbx'] = array(
        'name'        => esc_html__('Maori background', 'maori'),
        'type'        => 'checkbox',
        'group'       => 'design',
        'description' => esc_html__('Add black background to the row.', 'maori'),
        'priority'    => 4,
    );
    $fields['maoribg'] = array(
        'name'        => esc_html__('Maori stretched background', 'maori'),
        'type'        => 'checkbox',
        'group'       => 'design',
        'description' => esc_html__('Add black background to the row.', 'maori'),
        'priority'    => 4,
    );
    $fields['maorishadow'] = array(
        'name'        => esc_html__('Maori shadow', 'maori'),
        'type'        => 'checkbox',
        'group'       => 'design',
        'description' => esc_html__('Add shadow to the row.', 'maori'),
        'priority'    => 4,
    );
    return $fields;
}

add_filter( 'siteorigin_panels_row_style_fields', 'maori_row_style_fields' );

function maori_row_style_attributes( $attributes, $args ) {
    if( !empty( $args['maoripbx'] ) ) {
        array_push($attributes['class'], 'maori-page-box');
    }
    if( !empty( $args['maoribg'] ) ) {
        array_push($attributes['class'], 'maori-slider-wrapper');
    }
    if( !empty( $args['maorishadow'] ) ) {
        array_push($attributes['class'], 'maori-add-shadow');
    }
    return $attributes;
}

add_filter('siteorigin_panels_row_style_attributes', 'maori_row_style_attributes', 10, 2);

/* ----------------------------------------------------------
Add Custom Widget Field
------------------------------------------------------------- */
function maori_widget_style_fields($fields) {
  $fields['maorishadow'] = array(
        'name'        => esc_html__('Maori shadow', 'maori'),
        'type'        => 'checkbox',
        'group'       => 'design',
        'description' => esc_html__('Add shadow to the widget.', 'maori'),
        'priority'    => 4,
  );
  return $fields;
}

add_filter( 'siteorigin_panels_widget_style_fields', 'maori_widget_style_fields' );

function maori_widget_style_attributes( $attributes, $args ) {
    if( !empty( $args['maorishadow'] ) ) {
        array_push($attributes['class'], 'maori-add-shadow');
    }
    return $attributes;
}

add_filter('siteorigin_panels_widget_style_attributes', 'maori_widget_style_attributes', 10, 2);

/* ----------------------------------------------------------
Add Custom Icons
------------------------------------------------------------- */

function maori_icon_families_filter( $icon_families ) {
    $icon_families['maoriicon'] = array(
        'name' => esc_html__( 'Maori Icons', 'maori' ),
        'style_uri' => plugin_dir_url( __FILE__ ) . 'css/icons.css',
        'icons' => array(
            'alcohol' => '&#xf100;',
            'apron' => '&#xf101;',
            'autoclave' => '&#xf102;',
            'bandage' => '&#xf103;',
            'battery' => '&#xf104;',
            'brushes' => '&#xf105;',
            'cart' => '&#xf106;',
            'cartridge' => '&#xf107;',
            'case' => '&#xf108;',
            'chair' => '&#xf109;',
            'cleaningbrush' => '&#xf10a;',
            'cord' => '&#xf10b;',
            'cream' => '&#xf10c;',
            'gloves' => '&#xf10d;',
            'grip' => '&#xf10e;',
            'heart' => '&#xf10f;',
            'holder' => '&#xf110;',
            'ink' => '&#xf111;',
            'ink1' => '&#xf112;',
            'keys' => '&#xf113;',
            'license' => '&#xf114;',
            'markers' => '&#xf115;',
            'needle' => '&#xf116;',
            'needles' => '&#xf117;',
            'needles1' => '&#xf118;',
            'notebook' => '&#xf119;',
            'open' => '&#xf11a;',
            'pad' => '&#xf11b;',
            'paper' => '&#xf11c;',
            'pedal' => '&#xf11d;',
            'petroleum' => '&#xf11e;',
            'portfolio' => '&#xf11f;',
            'power' => '&#xf120;',
            'razor' => '&#xf121;',
            'rose' => '&#xf122;',
            'ruler' => '&#xf123;',
            'skin' => '&#xf124;',
            'skull' => '&#xf125;',
            'soap' => '&#xf126;',
            'soap1' => '&#xf127;',
            'spray' => '&#xf128;',
            'stencil' => '&#xf129;',
            'stool' => '&#xf12a;',
            'store' => '&#xf12b;',
            'table' => '&#xf12c;',
            'tape' => '&#xf12d;',
            'tatoomachine' => '&#xf12e;',
            'tattoo' => '&#xf12f;',
            'tips' => '&#xf130;',
            'wipe' => '&#xf131;'
        ),
    );
    return $icon_families;
}
add_filter( 'siteorigin_widgets_icon_families', 'maori_icon_families_filter' );
?>
Page not found – Hello World !