id_base == $block_class) unset($as_registered_blocks[$block_class]); } } /** Get list of all blocks **/ function as_get_blocks($template_id) { global $as_page_builder; $blocks = $as_page_builder->get_blocks($template_id); return $blocks; } /** * Form Field Helper functions * * Provides some default fields for use in the blocks * * @todo build this into a separate class instead! ********************************************************/ /* Input field - Options: $size = min, small, full */ function as_field_input($field_id, $block_id, $input, $size = 'full', $type = 'text') { $output = ''; return $output; } /* Input field for icon font - Options: $size = min, small, full */ function as_field_input_icon($field_id, $block_id, $input, $size = 'full', $type = 'text') { $output = ''; return $output; } /* Textarea field */ function as_field_textarea($field_id, $block_id, $text, $size = 'full') { $output = ''; return $output; } /* Select field */ function as_field_select($field_id, $block_id, $options, $selected) { $options = is_array($options) ? $options : array(); $output = ''; return $output; } /* Select field in*/ function as_field_select_in($id, $name, $options, $selected) { $options = is_array($options) ? $options : array(); $output = ''; return $output; } /* Multiselect field */ function as_field_multiselect($field_id, $block_id, $options, $selected_keys = array()) { $output = ''; return $output; } /* Overlay Color picker field */ function as_field_color_picker_overlay($field_id, $block_id, $color, $default = '') { $output = '
'; $output .= ''; $output .= '
'; return $output; } /* Color picker field */ function as_field_color_picker($field_id, $block_id, $color, $default = '') { $output = '
'; $output .= ''; $output .= '
'; return $output; } /* Color picker field in*/ function as_field_color_picker_in($id, $name, $color, $default = '') { $output = '
'; $output .= ''; $output .= '
'; return $output; } /* Single Checkbox */ function as_field_checkbox($field_id, $block_id, $check) { $output = ''; $output .= ''; return $output; } /* Checkbox in */ function as_field_checkbox_in($id, $name, $check) { $output = ''; $output .= ''; return $output; } /* Multi Checkbox */ function as_field_multicheck($field_id, $block_id, $fields = array(), $selected = array()) { } /* Media Uploader */ function as_field_upload($field_id, $block_id, $media, $media_type = 'image') { $output = ''; $output .= 'Upload

'; return $output; } /* Media Uploader in*/ function as_field_upload_in($id, $name, $media, $media_type = 'image') { $output = ''; $output .= 'Upload

'; return $output; } /** * Misc Helper Functions **************************/ /** Get column width * @parameters - $size (column size), $grid (grid size e.g 940), $margin */ function as_get_column_width($size, $grid = 940, $margin = 20) { $columns = range(1,12); $widths = array(); foreach($columns as $column) { $width = (( $grid + $margin ) / 12 * $column) - $margin; $width = round($width); $widths[$column] = $width; } $column_id = absint(preg_replace("/[^0-9]/", '', $size)); $column_width = $widths[$column_id]; return $column_width; } /** Recursive sanitize * For those complex multidim arrays * Has impact on server load on template save, so use only where necessary */ function as_recursive_sanitize($value) { if(is_array($value)) { $value = array_map('as_recursive_sanitize', $value); } else { $value = htmlspecialchars(stripslashes($value)); } return $value; } }