public static function _construct()
 {
     global $pagenow;
     self::$themes = piklist::get_directory_list(piklist::$paths['piklist'] . '/themes');
     add_action($pagenow == 'customize.php' ? 'customize_controls_init' : 'init', array('piklist_theme', 'init'));
     add_action('setup_theme', array('piklist_theme', 'setup_theme'));
     add_action('wp_head', array('piklist_theme', 'register_assets_head'), -1);
     add_action('wp_footer', array('piklist_theme', 'register_assets_footer'), -1);
     add_action('admin_head', array('piklist_theme', 'register_assets_head'), -1);
     add_action('admin_footer', array('piklist_theme', 'register_assets_footer'), -1);
     if (version_compare($GLOBALS['wp_version'], '4.2', '<')) {
         add_action('wp_head', array('piklist_theme', 'conditional_scripts_start'), -1);
         add_action('wp_footer', array('piklist_theme', 'conditional_scripts_start'), -1);
         add_action('admin_head', array('piklist_theme', 'conditional_scripts_start'), -1);
         add_action('admin_footer', array('piklist_theme', 'conditional_scripts_start'), -1);
         add_action('customize_controls_print_styles', array('piklist_theme', 'conditional_scripts_start'), -1);
         add_action('customize_controls_print_scripts', array('piklist_theme', 'conditional_scripts_start'), -1);
         add_action('customize_controls_print_footer_scripts', array('piklist_theme', 'conditional_scripts_start'), -1);
         add_action('wp_head', array('piklist_theme', 'conditional_scripts_end'), 101);
         add_action('wp_footer', array('piklist_theme', 'conditional_scripts_end'), 101);
         add_action('admin_head', array('piklist_theme', 'conditional_scripts_end'), 101);
         add_action('admin_footer', array('piklist_theme', 'conditional_scripts_end'), 101);
         add_action('customize_controls_print_styles', array('piklist_theme', 'conditional_scripts_end'), 101);
         add_action('customize_controls_print_scripts', array('piklist_theme', 'conditional_scripts_end'), 101);
         add_action('customize_controls_print_footer_scripts', array('piklist_theme', 'conditional_scripts_end'), 101);
     }
     add_filter('body_class', array('piklist_theme', 'body_class'));
     add_filter('post_class', array('piklist_theme', 'post_class'));
     add_filter('piklist_assets', array('piklist_theme', 'assets'));
 }
 public static function register_notices_callback($arguments)
 {
     $screen = get_current_screen();
     extract($arguments);
     $file = $path . '/parts/' . $folder . '/' . $part;
     $data = get_file_data($file, apply_filters('piklist_get_file_data', array('notice_id' => 'Notice ID', 'notice_type' => 'Notice Type', 'capability' => 'Capability', 'role' => 'Role', 'page' => 'Page'), 'notice'));
     $data = apply_filters('piklist_add_part', $data, 'notice');
     $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_piklist_notices', true));
     if (!empty($dismissed[0]) && in_array($data['notice_id'], $dismissed)) {
         return;
     }
     $page = str_replace(' ', '', $data['page']);
     $pages = $page ? explode(',', $page) : false;
     if ($screen->id == $page || empty($page) || in_array($screen->id, $pages)) {
         if ($data['capability'] && !current_user_can($data['capability']) || $data['role'] && !piklist_user::current_user_role($data['role'])) {
             return false;
         } else {
             $content = array('content' => trim(piklist::render($file, null, true)));
             if (isset($data)) {
                 $data = array_merge($data, $content);
                 self::$notices[] = $data;
             }
         }
     }
 }
Example #3
0
 /**
  * register_help_callback
  * Handle and render a registered help tab.
  *
  * @param array $arguments The help tab configuration.
  *
  * @access public
  * @static
  * @since 1.0
  */
 public static function register_help_callback($arguments)
 {
     extract($arguments);
     $screen = get_current_screen();
     $content = '';
     foreach ($render as $file) {
         $content .= piklist::render($file, array('data' => $data), true);
     }
     if ($data['sidebar'] == 'true') {
         $screen->set_help_sidebar($content);
     } else {
         $existing = $screen->get_help_tab($id);
         if ($existing) {
             if (empty($data['title'])) {
                 $data['title'] = $existing['title'];
             }
             switch ($data['extend_method']) {
                 case 'before':
                     $content = $content . $existing['content'];
                     break;
                 case 'after':
                     $content = $existing['content'] . $content;
                     break;
                 case 'replace':
                     $content = $content;
                     break;
             }
         }
         $screen->add_help_tab(array('id' => $id, 'title' => __($data['title']), 'content' => $content));
     }
 }
 function __construct($arguments)
 {
     global $wpdb;
     extract($arguments);
     // TODO: Require fields
     $this->key = $key;
     $this->name = $name;
     $this->table_id = piklist::slug($this->name);
     $this->column = $column;
     $this->columns = $columns;
     $this->classes = isset($classes) ? $classes : array('widefat', 'fixed');
     $this->sortable_columns = isset($sortable_columns) ? $sortable_columns : false;
     $this->actions = isset($actions) ? $actions : $this->actions;
     $this->per_page = isset($per_page) ? $per_page : 10;
     $this->ajax = isset($ajax) ? $ajax : false;
     $this->export = isset($export) ? $export : false;
     if (isset($data)) {
         $this->data = is_object($data) || is_array($data) ? piklist::object_to_array($data) : $wpdb->get_results($data, ARRAY_A);
         usort($this->data, array($this, 'data_sort'));
         $this->current_page = $this->get_pagenum();
         $this->total_items = count($this->data);
         // TODO: If sql use orderby
         // TODO: Implement offset in sql with current_page
     } else {
         $this->data = array();
         $this->current_page = 1;
         $this->total_items = 0;
     }
     parent::__construct(array('singular' => piklist::singularize($this->name), 'plural' => piklist::pluralize($this->name), 'ajax' => $this->ajax));
 }
 public static function widgets_init()
 {
     global $wp_widget_factory, $wp_version;
     $widget_class = 'piklist_universal_widget';
     foreach (piklist::$paths as $from => $path) {
         if (!piklist::directory_empty($path . '/parts/widgets')) {
             $widget_class_name = $widget_class . '_' . piklist::slug($from);
             $suffix = '';
             if (isset(piklist_add_on::$available_add_ons[$from])) {
                 if (stripos(piklist_add_on::$available_add_ons[$from]['Name'], 'widget') === false) {
                     $suffix = ' ' . __('Widgets', 'piklist');
                 }
                 $title = piklist_add_on::$available_add_ons[$from]['Name'] . $suffix;
                 $description = strip_tags(piklist_add_on::$available_add_ons[$from]['Description']);
             } elseif ($from == 'piklist') {
                 $title = __('Piklist Widgets', 'piklist');
                 $description = __('Core Widgets for Piklist.', 'piklist');
             } elseif ($from == 'theme') {
                 $current_theme = wp_get_theme();
                 $title = $current_theme . ' ' . __('Widgets', 'piklist');
                 $description = sprintf(__('Widgets for the %s Theme', 'piklist'), $current_theme);
             }
             $wp_widget_factory->widgets[$widget_class_name] = new $widget_class($widget_class_name, $title, $description, array($from => $path));
         }
     }
 }
 public static function register_help_tabs_callback($arguments)
 {
     $screen = get_current_screen();
     extract($arguments);
     $file = $path . '/parts/' . $folder . '/' . $part;
     $data = get_file_data($file, apply_filters('piklist_get_file_data', array('title' => 'Title', 'capability' => 'Capability', 'role' => 'Role', 'page' => 'Page', 'sidebar' => 'Sidebar'), 'help'));
     $data = apply_filters('piklist_add_part', $data, 'help');
     $pages = isset($data['page']) ? explode(',', $data['page']) : false;
     if (($screen->id == $data['page'] || empty($data['page']) || in_array($screen->id, $pages)) && (isset($data['capability']) && current_user_can($data['capability']) || isset($data['role']) && piklist_user::current_user_role($data['role']))) {
         if ($data['sidebar'] == 'true') {
             get_current_screen()->set_help_sidebar(piklist::render($file, null, true));
         } else {
             get_current_screen()->add_help_tab(array('id' => piklist::dashes($add_on . '-' . $part), 'title' => $data['title'], 'content' => piklist::render($file, null, true)));
         }
     }
 }
 private static function register_add_on($add_on, $file, $path, $plugin = false)
 {
     if (file_exists($file)) {
         $active_add_ons = piklist::get_settings('piklist_core_addons', 'add-ons');
         $data = get_plugin_data($file);
         $data['plugin'] = $plugin;
         self::$available_add_ons[$add_on] = $data;
         if (in_array($add_on, is_array($active_add_ons) ? $active_add_ons : array($active_add_ons))) {
             include_once $file;
             $class_name = str_replace(piklist::$prefix, 'piklist_', piklist::slug($add_on));
             if (class_exists($class_name) && method_exists($class_name, '_construct') && !is_subclass_of($class_name, 'WP_Widget')) {
                 call_user_func(array($class_name, '_construct'));
             }
             piklist::$paths[$add_on] = $path . (!$plugin ? '/' . $add_on : '');
         }
     }
 }
 public static function register_pointers_callback($arguments)
 {
     $screen = get_current_screen();
     extract($arguments);
     $file = $path . '/parts/' . $folder . '/' . $part;
     $data = get_file_data($file, apply_filters('piklist_get_file_data', array('title' => 'Title', 'pointer_id' => 'Pointer ID', 'capability' => 'Capability', 'role' => 'Role', 'page' => 'Page', 'anchor' => 'Anchor ID', 'edge' => 'Edge', 'align' => 'Align'), 'pointer'));
     $data = apply_filters('piklist_add_part', $data, 'pointer');
     $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true));
     if (in_array($data['pointer_id'], $dismissed)) {
         return;
     }
     $pages = isset($data['page']) ? explode(',', $data['page']) : false;
     if ($screen->id == $data['page'] || empty($data['page']) || in_array($screen->id, $pages)) {
         if ($data['capability'] && !current_user_can($data['capability']) || $data['role'] && !piklist_user::current_user_role($data['role'])) {
             return false;
         } else {
             $content = array('content' => trim(piklist::render($file, null, true)));
             $data = array_merge($data, $content);
             self::$pointers[] = $data;
         }
     }
 }
 public static function activate()
 {
     piklist::check_network_propagate('do_action', 'piklist_activate');
 }
 public static function check(&$stored_data = null)
 {
     if (!isset($_REQUEST[piklist::$prefix]['fields_id']) || !($fields_data = get_transient(piklist::$prefix . $_REQUEST[piklist::$prefix]['fields_id']))) {
         return false;
     }
     $fields_id = $_REQUEST[piklist::$prefix]['fields_id'];
     foreach ($fields_data as $type => &$fields) {
         foreach ($fields as &$field) {
             if (!is_null($stored_data)) {
                 $request_data =& $stored_data;
             } else {
                 if (isset($_REQUEST['widget-id']) && isset($_REQUEST['multi_number']) && isset($_REQUEST['widget_number'])) {
                     $widget_index = !empty($_REQUEST['multi_number']) ? $_REQUEST['multi_number'] : $_REQUEST['widget_number'];
                     $request_data =& $_REQUEST[piklist::$prefix . $field['scope']][$widget_index];
                 } elseif (isset($field['scope']) && !empty($field['scope'])) {
                     $request_data =& $_REQUEST[piklist::$prefix . $field['scope']];
                 } else {
                     $request_data =& $_REQUEST;
                 }
             }
             if (isset($request_data) && isset($field['field'])) {
                 $field['request_value'] = !strstr($field['field'], ':') ? isset($request_data[$field['field']]) ? $request_data[$field['field']] : null : piklist::array_path_get($request_data, explode(':', $field['field']));
                 $field['valid'] = true;
                 if (stristr($field['field'], ':0:')) {
                     $_field = $field['field'];
                     $value = array();
                     $index = 0;
                     do {
                         $_value = piklist::array_path_get($request_data, explode(':', $_field));
                         if (isset($_value[$index]) && count($_value[$index]) > 1 && in_array($field['type'], piklist_form::$field_list_types['multiple_value']) && $field['add_more']) {
                             $_value[$index] = array_values(array_filter($_value[$index]));
                         }
                         if (isset($_value[$index])) {
                             array_push($value, $_value);
                             piklist::array_path_set($request_data, explode(':', $_field), $_value);
                             $_field = strrev(implode(strrev(':' . ($index + 1) . ':'), explode(':' . $index . ':', strrev($_field), 2)));
                         } else {
                             break;
                         }
                         $index++;
                     } while (isset($_value[$index]));
                     $field['request_value'] = $_value;
                 } elseif ($field['type'] == 'group' && empty($field['field'])) {
                     $field['request_value'] = array();
                     foreach ($field['fields'] as $_field) {
                         $field['request_value'][$_field['field']] = !strstr($_field['field'], ':') ? isset($request_data[$_field['field']]) ? $request_data[$_field['field']] : null : piklist::array_path_get($request_data, explode(':', $_field['field']));
                     }
                 } else {
                     $index = 0;
                     do {
                         if (isset($field['request_value'][$index]) && count($field['request_value'][$index]) > 1 && $field['type'] == 'checkbox') {
                             $field['request_value'][$index] = array_values(array_filter($field['request_value'][$index]));
                         }
                         $index++;
                     } while (isset($field['request_value'][$index]));
                     piklist::array_path_set($request_data, explode(':', $field['field']), $field['request_value']);
                 }
                 if (isset($field['sanitize'])) {
                     foreach ($field['sanitize'] as $sanitize) {
                         if (isset(self::$sanitization_rules[$sanitize['type']])) {
                             $sanitization = array_merge(self::$sanitization_rules[$sanitize['type']], $sanitize);
                             if (isset($sanitization['callback'])) {
                                 foreach ($field['request_value'] as $request_value) {
                                     $request_value = call_user_func_array($sanitization['callback'], array($request_value, $field, isset($sanitize['options']) ? $sanitize['options'] : array()));
                                     $request_value = is_array($request_value) ? $request_value : array($request_value);
                                     piklist::array_path_set($request_data, explode(':', $field['field']), $request_value);
                                 }
                             }
                         }
                     }
                 }
                 self::add_request_value($field);
                 if (isset($field['required']) && $field['required']) {
                     for ($index = 0; $index < count($field['request_value']); $index++) {
                         $request_value = is_array($field['request_value'][$index]) ? array_filter($field['request_value'][$index]) : $field['request_value'][$index];
                         if (empty($request_value)) {
                             self::add_error($field, $index, __('is a required field.', 'piklist'));
                         }
                     }
                 }
                 if (isset($field['validate'])) {
                     foreach ($field['validate'] as $validate) {
                         if (isset(self::$validation_rules[$validate['type']])) {
                             $validation = array_merge(self::$validation_rules[$validate['type']], $validate);
                             $request_values = $field['request_value'];
                             if ($field['type'] == 'group') {
                                 $_request_values = array();
                                 foreach ($request_values as $key => $values) {
                                     foreach ($values as $index => $value) {
                                         if (!isset($_request_values[$index])) {
                                             $_request_values[$index] = array();
                                         }
                                         $_request_values[$index][$key] = $value;
                                     }
                                 }
                                 $request_values = array($_request_values);
                             }
                             if (isset($validation['rule'])) {
                                 for ($index = 0; $index < count($request_values); $index++) {
                                     if (!empty($request_values[$index]) && !preg_match($validation['rule'], $request_values[$index])) {
                                         self::add_error($field, $index, $validation['message']);
                                     }
                                 }
                             }
                             if (isset($validation['callback'])) {
                                 for ($index = 0; $index < count($request_values); $index++) {
                                     if (!empty($request_values[$index]) || $field['type'] != 'group' && $field['add_more']) {
                                         $validation_result = call_user_func_array($validation['callback'], array($request_values[$index], $field, isset($validate['options']) ? $validate['options'] : array()));
                                         if ($validation_result !== true) {
                                             self::add_error($field, $index, isset($validation['message']) ? $validation['message'] : (is_string($validation_result) ? $validation_result : __('is not valid input', 'piklist')));
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     self::set_data($fields_id);
     return !empty(self::$submission['errors']) ? false : $fields_data;
 }
 public static function run_update($valid_updates)
 {
     piklist::performance();
     foreach ($valid_updates as $valid_update) {
         $function = $valid_update;
         $function();
     }
 }
Example #12
0
    ?>
"
        value="<?php 
    echo esc_attr($values[$index]);
    ?>
"
        <?php 
    echo $active ? 'checked="checked"' : '';
    ?>
        <?php 
    echo piklist_form::attributes_to_string($attributes);
    ?>
      />
    
      <a href="#<?php 
    echo piklist::dashes(piklist_add_on::$available_add_ons[$values[$index]]['Name']);
    ?>
" class="button<?php 
    echo $active ? '' : '-primary';
    ?>
 piklist-field-add-on-button">
        <?php 
    $active ? _e('Disable', 'piklist') : _e('Activate', 'piklist');
    ?>
      </a>

      <?php 
    if (isset($settings[$values[$index]])) {
        ?>
      
        <a href="<?php 
 public function register_widgets_callback($arguments)
 {
     extract($arguments);
     if (!strstr($part, '-form.php')) {
         $path .= '/parts/' . $folder . '/';
         $name = piklist::dashes(strtolower(str_replace('.php', '', $part)));
         $form = file_exists($path . $name . '-form.php') ? $path . $name . '-form' : false;
         if ($form) {
             $data = get_file_data($form . '.php', apply_filters('piklist_get_file_data', array('height' => 'Height', 'width' => 'Width'), 'widgets'));
             $data = apply_filters('piklist_add_part', $data, 'widgets');
         } else {
             $data = null;
         }
         $this->widgets[$name] = array('name' => $name, 'add_on' => $add_on, 'path' => $path . $name, 'form' => $form, 'form_data' => $data, 'data' => get_file_data($path . $part, array('title' => 'Title', 'description' => 'Description', 'tags' => 'Tags', 'class' => 'Class')));
     }
 }
Example #14
0
 /**
  * register_pointer_callback
  * Handle and render a registered admin pointer.
  *
  * @param array $arguments The part object.
  *
  * @access public
  * @static
  * @since 1.0
  */
 public static function register_pointer_callback($arguments)
 {
     extract($arguments);
     $content = '<h3>' . $data['title'] . '</h3>';
     $dismissed = get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true);
     $dismissed = explode(',', $dismissed);
     if (!empty($dismissed[0]) && in_array($id, $dismissed)) {
         return false;
     }
     foreach ($render as $file) {
         $content .= piklist::render($file, array('data' => $data), true);
     }
     array_push(self::$pointers, array_merge($arguments, array('content' => $content)));
 }
Example #15
0
 /**
  * part_process
  * Dashboard specific processing on whether to allow core dashboard widgets.
  *
  * @param array $part being validated
  *
  * @return array The part object being processed.
  *
  * @access public
  * @static
  * @since 1.0
  */
 public static function part_process($part)
 {
     if ($part['id'] == 'dashboard_right_now') {
         return piklist::get_settings('piklist_core', 'dashboard_at_a_glance') ? $part : null;
     }
     return $part;
 }
 public static function multiple_roles_field($user)
 {
     global $pagenow, $user_id;
     if (in_array($pagenow, array('user-edit.php', 'user-new.php'))) {
         $editable_roles = get_editable_roles();
         if ($user_id) {
             $user = get_user_to_edit($user_id);
             $user_roles = array_intersect(array_values($user->roles), array_keys($editable_roles));
         } else {
             $user_roles = null;
         }
         $roles = array();
         foreach ($editable_roles as $role => $details) {
             $roles[$role] = translate_user_role($details['name']);
         }
         piklist::render('shared/field-user-role', array('user_roles' => $user_roles, 'roles' => $roles), false);
     }
 }
Example #17
0
File: form.php Project: a42/piklist
  enctype="multipart/form-data"
  id="<?php 
echo $id;
?>
"
  autocomplete="off"
  data-piklist-form="true"
  class="piklist-form <?php 
echo is_admin() ? 'hidden' : null;
?>
"
>
  <?php 
do_action('piklist_notices', $id);
foreach ($render as $form) {
    piklist::render($form, $data);
}
piklist('field', array('type' => 'hidden', 'scope' => piklist::$prefix, 'field' => 'form_id', 'value' => $id));
if ($data['filter']) {
    piklist('field', array('type' => 'hidden', 'scope' => piklist::$prefix, 'field' => 'filter', 'value' => 'true'));
}
if ($data['redirect']) {
    piklist('field', array('type' => 'hidden', 'scope' => piklist::$prefix, 'field' => 'redirect', 'value' => $data['redirect']));
}
if (piklist_admin::hide_ui()) {
    piklist('field', array('type' => 'hidden', 'scope' => piklist::$prefix, 'field' => 'admin_hide_ui', 'value' => 'true'));
}
piklist_form::save_fields();
?>
  
</form>
Example #18
0
 /**
  * meta_box
  * Render the meta box.
  *
  * @param $post
  *
  * @return
  *
  * @access public
  * @static
  * @since 1.0
  */
 public static function meta_box($post)
 {
     if (!empty(self::$meta_boxes)) {
         ob_start();
         $GLOBALS['piklist_attachment'] = $post;
         uasort(self::$meta_boxes, array('piklist', 'sort_by_data_order'));
         foreach (self::$meta_boxes as $meta_box) {
             piklist::render('shared/meta-box-start', array('meta_box' => $meta_box, 'wrapper' => 'media_meta'), false);
             do_action('piklist_pre_render_media_meta_box', $post, $meta_box);
             foreach ($meta_box['render'] as $render) {
                 piklist::render($render, array('data' => $meta_box['data']), false);
             }
             do_action('piklist_post_render_media_meta_box', $post, $meta_box);
             piklist::render('shared/meta-box-end', array('meta_box' => $meta_box, 'wrapper' => 'media_meta'), false);
         }
         unset($GLOBALS['piklist_attachment']);
         $output = ob_get_contents();
         ob_end_clean();
         return $output;
     }
     return null;
 }
Example #19
0
function piklist_demo_workflow_bar($flow)
{
    if ($flow == 'demo_workflow') {
        $domain = $_SERVER['HTTP_HOST'];
        $url = 'http://' . $domain . $_SERVER['REQUEST_URI'];
        $help = piklist::render('shared/tooltip-help', array('message' => __('By default WorkFlows are setup as TABS. To change them to a BAR, use "Layout : Bar" in your Workflow Header file.', 'piklist-demo')), true);
        if (isset($_REQUEST['piklist_demo_workflow'])) {
            // remove demo_workflow parameter
            $url = preg_replace('/(.*)(?|&)piklist_demo_workflow=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');
            echo '<a href="' . $url . '" class="alignright button button-secondary demo-tab-bar">' . __('View as Tabs', 'piklist-demo') . $help . '</a>';
        } else {
            echo '<a href="' . $url . '&piklist_demo_workflow=bar" class="alignright button button-secondary demo-tab-bar">' . __('View as Bar', 'piklist-demo') . $help . '</a>';
        }
    }
}
<?php

$name = piklist_form::get_field_name($field, $scope, false, $prefix);
$_attributes = '';
foreach ($attributes as $_key => $_value) {
    if (substr($_key, 0, strlen('data-piklist-field-')) == 'data-piklist-field-') {
        $_attributes .= '" ' . $_key . '="' . $_value;
    }
}
wp_editor(isset($value) && !empty($value) ? $value : '', isset($id) ? $id : piklist::unique_id() . 'piklisteditor' . preg_replace('/[^a-z0-9]+/i', '', $name), array_merge(array('textarea_name' => $name . $_attributes, 'editor_height' => 180, 'quicktags' => true, 'textarea_rows' => 5), isset($options) && is_array($options) ? $options : array()));
Example #21
0
 /**
  * meta_box
  * Render the meta box.
  *
  * @param array $post The post object.
  * @param array $meta_box The meta box object.
  *
  * @access public
  * @static
  * @since 1.0
  */
 public static function meta_box($post, $meta_box)
 {
     do_action('piklist_pre_render_meta_box', $post, $meta_box);
     if ($meta_box['args']['render']) {
         foreach ($meta_box['args']['render'] as $render) {
             if (is_array($render)) {
                 call_user_func($render['callback'], $post, $render['args']);
             } else {
                 piklist::render($render, array('data' => $meta_box['args']['data']));
             }
         }
     }
     do_action('piklist_post_render_meta_box', $post, $meta_box);
 }
 public static function pre_update_option($new, $old = false)
 {
     if (false !== ($field_data = piklist_validate::check($new))) {
         $setting = $_REQUEST['option_page'];
         $_old = $old;
         foreach ($field_data[$setting] as $field => &$data) {
             if (!isset($data['display']) || isset($data['display']) && !$data['display']) {
                 if (!isset($new[$field]) && isset($_old[$field])) {
                     unset($_old[$field]);
                 }
                 if ((isset($data['add_more']) && !$data['add_more'] || !isset($data['add_more'])) && (isset($new[$field]) && isset($new[$field][0]) && count($new[$field]) == 1)) {
                     $new[$field] = is_array($new[$field][0]) && count($new[$field][0]) == 1 ? $new[$field][0][0] : $new[$field][0];
                 }
                 if (isset($new[$field]) && is_array($new[$field]) && count($new[$field]) > 1 && empty($new[$field][0]) && isset($new[$field][0])) {
                     unset($new[$field][0]);
                     $new[$field] = array_values($new[$field]);
                 }
                 if (isset($data['field'])) {
                     $path = array_merge(array($setting, 'name'), strstr($data['field'], ':') ? explode(':', $data['field']) : array($data['field']));
                     if (piklist::array_path_get($_FILES, $path) && $data['type'] == 'file') {
                         $data['request_value'] = piklist_form::save_upload($path, $data['request_value'], true);
                         $path = explode(':', $data['field']);
                         $parent_field = $path[0];
                         unset($path[0]);
                         piklist::array_path_set($new[$parent_field], $path, $data['request_value']);
                     }
                 }
             }
         }
         $settings = wp_parse_args($new, $_old);
         $settings = apply_filters('piklist_pre_update_option', $settings, $setting, $new, $old);
         $settings = apply_filters('piklist_pre_update_option_' . $setting, $settings, $new, $old);
     } else {
         $settings = $old;
     }
     return $settings;
 }
            $active_data = $data;
        }
    }
}
?>
  
      <?php 
do_action('piklist_workflow_flow_append', $data['config']['flow_slug']);
?>
  
    </h2>

    <?php 
if (isset($active_data) && $active_data) {
    do_action('piklist_pre_render_workflow', $active_data);
    piklist::render($active_data['part'], array('data' => $active_data));
    do_action('piklist_post_render_workflow', $active_data);
}
?>

<?php 
if ($position == 'header') {
    ?>
 
    
    <br />
    
  </div>

<?php 
}
Example #24
0
 public function needs_update($object)
 {
     return is_array($object) && !piklist::is_flat($object) && !isset($object[0]);
 }
Example #25
0
  Copyright (c) 2012-2015 Piklist, LLC.
  All rights reserved.

  This software is distributed under the GNU General Public License, Version 2,
  June 1991. Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin
  St, Fifth Floor, Boston, MA 02110, USA

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

  *******************************************************************************
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *******************************************************************************
*/
if (!defined('ABSPATH')) {
    exit;
}
if (!class_exists('Piklist')) {
    include_once 'includes/class-piklist.php';
    piklist::load();
}
 /**
  * part_id
  * Specify the part id.
  *
  * @param string $part_id The current id for the part.
  * @param string $add_on The add-on for the part.
  * @param string $part The current id for the part
  * @param array $part_data The part object.
  *
  * @return string The update part id.
  *
  * @access public
  * @static
  * @since 1.0
  */
 public function part_id($part_id, $add_on, $part, $part_data)
 {
     return piklist::slug($add_on . ' ' . str_replace('-form.php', '.php', strtolower($part)));
 }
Example #27
0
 /**
  * notice
  * Render the admin notices.
  *
  * @access public
  * @static
  * @since 1.0
  */
 public static function notice()
 {
     foreach (self::$notices as $notices => $notice) {
         piklist::render('shared/notice', array('type' => $notice['data']['notice_type'], 'content' => $notice['content'], 'id' => $notice['id'], 'notice_type' => $notice['data']['notice_type'], 'dismiss' => $notice['data']['dismiss']));
     }
 }
Example #28
0
 /**
  * render_workflow
  * Render a workflow if applicable.
  *
  * @access public
  * @static
  * @since 1.0
  */
 public static function render_workflow()
 {
     if (self::$workflow) {
         $position = self::$workflow['workflows'][0]['data']['position'];
         $backtrace = debug_backtrace();
         foreach ($backtrace as $trace) {
             if ($trace['function'] == 'do_action' && isset($trace['args'][0]) && array_search($trace['args'][0], self::$after_positions) == $position) {
                 self::$workflow['position'] = $position;
                 self::$workflow['layout'] = self::$workflow['workflows'][0]['data']['layout'];
                 piklist::render('shared/admin-workflow', self::$workflow);
                 break;
             }
         }
     }
 }
<?php

/*  
Title: Lists
*/
?>

<?php 
echo $before_widget;
?>

  <?php 
echo $before_title;
?>
  
  <?php 
echo $after_title;
?>

    <?php 
piklist::pre($settings);
?>
    
<?php 
echo $after_widget;
Example #30
0
 /**
  * get_file_data
  * Get file data and try and cast the values.
  *
  * @param string $file File path to read.
  * @param array $data Attributes to fetch.
  *
  * @access public
  * @static
  * @since 1.0
  */
 public static function get_file_data($file, $data)
 {
     $data = get_file_data($file, $data);
     array_walk_recursive($data, array('piklist', 'array_values_cast'));
     foreach ($data as $parameter => &$value) {
         switch ($parameter) {
             case 'capability':
             case 'id':
             case 'page':
             case 'post_type':
             case 'role':
             case 'status':
             case 'taxonomy':
             case 'post_format':
                 $value = piklist::explode(',', $value, 'strtolower');
                 $value = array_filter($value);
                 $value = empty($value) ? null : $value;
                 break;
             case 'template':
                 $value = piklist::explode(',', $value, 'strtolower');
                 $value = str_ireplace('.php', '', $value);
                 $value = array_filter($value);
                 $value = empty($value) ? null : $value;
                 break;
             case 'flow':
             case 'flow_page':
             case 'tab':
             case 'sub_tab':
                 $value = piklist::explode(',', $value, array('piklist', 'slug'));
                 $value = array_filter($value);
                 $value = empty($value) ? null : $value;
                 break;
             default:
                 /**
                  * piklist_part_data_parameter
                  * Add custom part parameters to check.
                  *
                  * @param $value Value to compare.
                  * @param $parameter Parameter to check.
                  *
                  * @since 1.0
                  */
                 $value = apply_filters('piklist_part_data_parameter', $value, $parameter);
                 break;
         }
     }
     return $data;
 }