__('AT Piechart', 'aakanksha'), 'size' => 'span12', ); //create the widget parent::__construct('as_Piechart_Block', $block_options); //add ajax functions add_action('wp_ajax_as_block_piechart_add_new', array($this, 'add_piechart')); } function form($instance) { $defaults = array( 'piecharts' => array( 1 => array( 'title' => 'Add new piechart', 'percent' => '100', 'easing' => 'easeOutExpo', 'animate' => '4000', 'cap' => 'square', 'width' => '5', 'track' => '#ecf0f1', 'bar' => '#5ac3bc', ) ), 'column' => 'three', 'margin_top' => 10, 'margin_bottom' => 10, ); $instance = wp_parse_args($instance, $defaults); extract($instance); $pie_columns = array( 'two' => 'Two Columns', 'three' => 'Three Columns', 'four' => 'Four Columns', ); ?>

 - 

Add New

'Square', 'butt' => 'Butt', 'round' => 'Round', ); ?>
  • ms(Millisecond) -  (%)

    px(pixel) - 

  • ' .htmlspecialchars_decode($piechart['title']). '

    '; if($i%3 == 0 && $i != sizeof($piecharts) && $span == 'col-md-4') $output .= '
    '; if($i%4 == 0 && $i != sizeof($piecharts) && $span == 'col-md-3') $output .= '
    '; if($i%6 == 0 && $i != sizeof($piecharts) && $span == 'col-md-2') $output .= '
    '; $i++; } echo $output; } /* AJAX add piechart */ function add_piechart() { $nonce = $_POST['security']; if (! wp_verify_nonce($nonce, 'aspb-settings-page-nonce') ) die('-1'); $count = isset($_POST['count']) ? absint($_POST['count']) : false; $this->block_id = isset($_POST['block_id']) ? $_POST['block_id'] : 'as-block-9999'; //default key/value for the piechart $piechart = array( 'title' => 'Add new piechart', 'percent' => '100', 'easing' => 'easeOutExpo', 'animate' => '4000', 'cap' => 'square', 'width' => '5', 'track' => '#ecf0f1', 'bar' => '#5ac3bc', ); if($count) { $this->piechart($piechart, $count); } else { die(-1); } die(); } function update($new_instance, $old_instance) { $new_instance = as_recursive_sanitize($new_instance); return $new_instance; } function before_block($instance) { extract($instance); echo '
    '; } function after_block($instance) { extract($instance); echo '
    '; } } as_register_block( 'as_Piechart_Block' ); endif;