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; } } } }
/** * 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)); } }
/** * render * This method will render a list table using the universal piklist list table. * * @param array $arguments Configuration options for the table. * * @access public * @static * @since 1.0 */ public static function render($arguments) { extract($arguments); $list_table = new Piklist_List_Table_Template($arguments); $list_table->arguments = $arguments; $list_table->prepare_items(); piklist::render('shared/list-table', array('list_table' => $list_table, 'name' => $name, 'export' => isset($export) ? $export : false, 'form_id' => 'piklist_list_table_form_' . piklist::slug($name))); }
public static function register_settings_section_callback($arguments) { extract($arguments); $section = self::$setting_section_callback_args[$id]; self::$active_section = $section; do_action('piklist_pre_render_setting_section', $section); piklist::render($section['path'] . '/parts/' . $section['folder'] . '/' . $section['part']); do_action('piklist_post_render_setting_section', $section); self::$active_section = null; }
public static function admin_notices() { if (!empty(self::$submission['errors'])) { $messages = array(); foreach (self::$submission['errors'] as $type => $fields) { foreach ($fields as $field => $errors) { array_push($messages, current($errors)); } } piklist::render('shared/admin-notice', array('type' => 'error', 'messages' => $messages)); } }
public static function meta_box($tag = null, $taxonomy) { if ($taxonomy) { if (!self::$meta_box_nonce) { piklist_form::render_field(array('type' => 'hidden', 'field' => 'nonce', 'value' => wp_create_nonce(plugin_basename(piklist::$paths['piklist'] . '/piklist.php')), 'scope' => piklist::$prefix)); self::$meta_box_nonce = true; } $wrapper = 'term_meta'; foreach (self::$meta_boxes[$taxonomy] as $taxonomy => $meta_box) { piklist::render('shared/meta-box-start', array('meta_box' => $meta_box, 'wrapper' => $wrapper), false); piklist::render($meta_box['part'], array('taxonomy' => $taxonomy, 'prefix' => 'piklist', 'plugin' => 'piklist'), false); piklist::render('shared/meta-box-end', array('meta_box' => $meta_box, 'wrapper' => $wrapper), false); } } }
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))); } } }
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; } } }
function piklist($option, $arguments = array()) { if (!is_array($arguments) && strstr($arguments, '=')) { parse_str($arguments, $arguments); } if (is_array($option) || is_object($option)) { $list = array(); $arguments = is_array($arguments) ? $arguments : array($arguments); foreach ($option as $key => $value) { if (count($arguments) > 1) { if (in_array('_key', $arguments)) { $_value = $arguments[1]; $list[$key] = is_object($value) ? $value->{$_value} : $value[$_value]; } else { $__key = $arguments[0]; $_key = is_object($value) ? $value->{$__key} : (isset($value[$__key]) ? $value[$__key] : null); $_value = $arguments[1]; $list[$_key] = is_object($value) ? $value->{$_value} : (isset($value[$_value]) ? $value[$_value] : null); } } else { $_value = $arguments[0]; array_push($list, is_object($value) && isset($value->{$_value}) ? $value->{$_value} : (isset($value[$_value]) ? $value[$_value] : null)); } } return $list; } else { switch ($option) { case 'field': if (piklist_setting::get('active_section')) { piklist_setting::register_setting($arguments); } else { piklist_form::render_field($arguments, isset($arguments['return']) ? $arguments['return'] : false); } break; case 'list_table': piklist_list_table::render($arguments); break; case 'post_type_labels': return piklist::post_type_labels($arguments); break; case 'taxonomy_labels': return piklist::taxonomy_labels($arguments); break; case 'option': case 'post_custom': case 'post_meta': case 'get_post_custom': case 'user_custom': case 'user_meta': case 'get_user_custom': case 'term_custom': case 'term_meta': case 'get_term_custom': switch ($option) { case 'user_custom': case 'user_meta': case 'get_user_custom': $type = 'user'; break; case 'term_custom': case 'term_meta': case 'get_term_custom': $type = 'term'; break; case 'post_custom': case 'post_meta': case 'get_post_custom': $type = 'post'; break; default: $type = 'option'; break; } return piklist::object($type, $arguments); break; case 'dashes': return piklist::dashes($arguments); break; case 'slug': return piklist::slug($arguments); break; case 'performance': piklist::performance(); break; case 'include_meta_boxes': // TODO: Improve if (isset($arguments['post_type'])) { $post_type = $arguments['post_type']; unset($arguments['post_type']); } else { $post_type = null; } piklist::include_meta_boxes($arguments, $post_type); break; case 'include_actions': // TODO: Improve if (isset($arguments['action'])) { $post_type = $arguments['action']; unset($arguments['action']); } piklist::include_actions($action, $arguments); break; case 'include_user_profile_fields': piklist_user::include_user_profile_fields($arguments); break; case 'comments_template': $file = isset($arguments[0]) ? $arguments[0] : '/comments.php'; $seperate_comments = isset($arguments[1]) ? $arguments[1] : false; piklist_comments::comments_template($file, $seperate_comments); break; default: $return = isset($arguments['return']) ? $arguments['return'] : false; $loop = isset($arguments['loop']) ? $arguments['loop'] : null; unset($arguments['return']); unset($arguments['loop']); return piklist::render($option, $arguments, $return, $loop); break; } } }
public static function admin_page() { $page = false; foreach (self::$admin_pages as $admin_page) { if ($_REQUEST['page'] === $admin_page['menu_slug']) { $page = $admin_page; break; } } if ($page) { $setting_tabs = piklist_setting::get('setting_tabs'); piklist::render('shared/admin-page', array('section' => $page['menu_slug'], 'icon' => isset($page['icon']) ? $page['icon'] : false, 'page_icon' => isset($page['page_icon']) ? $page['page_icon'] : (isset($page['icon']) ? $page['icon'] : null), 'single_line' => isset($page['single_line']) ? $page['single_line'] : false, 'title' => $page['page_title'], 'setting' => isset($page['setting']) ? $page['setting'] : false, 'tabs' => isset($page['setting']) && isset($setting_tabs[$page['setting']]) ? $setting_tabs[$page['setting']] : self::$admin_page_tabs[$page['menu_slug']], 'page_sections' => isset(self::$admin_page_sections[$page['menu_slug']]) ? self::$admin_page_sections[$page['menu_slug']] : array(), 'save' => isset($page['save']) ? $page['save'] : true, 'save_text' => isset($page['save_text']) ? $page['save_text'] : __('Save Changes', 'piklist'), 'page' => isset($admin_page['page']) ? $admin_page['page'] : false)); } }
/** * notices * Handle any form notices for forms with piklist fields. * * @param string $form_id The form id. * * @access public * @static * @since 1.0 */ public static function notices($form_id = null) { if (!empty(self::$form_submission) && self::$form_id && self::$form_id == $form_id && isset(self::$forms[self::$form_id]) && !empty(self::$forms[self::$form_id]['data']['message'])) { piklist::render('shared/notice', array('id' => 'piklist_form_notice', 'notice_type' => 'update', 'dismiss' => is_admin(), 'content' => self::$forms[self::$form_id]['data']['message'])); } }
public static function workflows() { if (empty(self::$workflows)) { return false; } global $pagenow, $typenow, $post; reset(self::$after_positions); $current_position = key(self::$after_positions); foreach (self::$workflows as $workflow => $path) { uasort($path, array('piklist', 'sort_by_config_order')); $path = array_values($path); $first = current($path); $position = isset($first['config']['position']) ? $first['config']['position'] : false; if ($position) { $pages = $first['config']['page']; $post_type = isset($first['config']['post_type']) ? $first['config']['post_type'] : false; if ((in_array($pagenow, $pages) || in_array($pagenow, array('admin.php', 'edit.php', 'users.php', 'plugins.php', 'options-general.php')) && (isset($_REQUEST['page']) && in_array($_REQUEST['page'], $pages))) && (!$post_type || $post_type && ($post && $typenow == $post_type || !$post && isset($_REQUEST['post_type']) == $post_type)) || isset($_REQUEST['flow']) && piklist::slug($workflow) == $_REQUEST['flow']) { $default = null; $has_active = false; foreach ($path as &$tab) { if (isset($tab['config']['default']) && $tab['config']['default'] == true) { $default =& $tab; } if (isset($tab['config']['active'])) { $has_active = true; } } if (!$has_active && $default) { $default['config']['active'] = true; } if ($position == $current_position) { piklist::render('shared/admin-workflow', array('workflow' => $workflow, 'path' => $path, 'pages' => $pages, 'position' => $position)); } } } } array_shift(self::$after_positions); }
public function widget($arguments, $instance) { extract($arguments); $this->register_widgets(); $instance = piklist::object_value($instance); $widget = $instance['widget']; if (!empty($widget)) { unset($instance['widget']); $this->widgets[$widget]['instance'] = $instance; piklist_widget::$current_widget = $this->widget_name; do_action('piklist_pre_render_widget', $this->widgets[$widget]); piklist::render($this->widgets[$widget]['path'], array('instance' => $instance, 'settings' => $instance, 'before_widget' => str_replace('class="', 'class="' . piklist::dashes($this->widgets[$widget]['add_on'] . ' ' . $this->widgets[$widget]['name']) . ' ' . $this->widgets[$widget]['data']['class'] . ' ', $before_widget), 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); do_action('piklist_post_render_widget', $this->widgets[$widget]); } }
/** * render_dashboad_widget * Render the dashboad widget * * @param mixed $null No data. * @param array $data Widget configuration. * * @access public * @static * @since 1.0 */ public static function render_dashboad_widget($null, $data) { $widget = self::$widgets[$data['id']]; do_action('piklist_pre_render_dashboard_widget', $null, $widget); if ($widget['render']) { foreach ($widget['render'] as $render) { if (is_array($render)) { call_user_func($render['callback'], $null, $render['args']); } else { piklist::render($render, array('data' => $widget['data'])); } } } do_action('piklist_post_render_dashboard_widget', $null, $widget); }
/** * 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'])); } }
public static function render_form($attributes, $content = '') { extract(shortcode_atts(array('form' => false, 'add_on' => false), $attributes)); if ($form) { if ($add_on && isset(piklist::$paths[$add_on])) { $paths[$add_on] = piklist::$paths[$add_on]; } else { $paths = piklist::$paths[$add_on]; } if (empty($paths)) { return false; } foreach ($paths as $display => $path) { if (in_array($form . '.php', piklist::get_directory_list($path . '/parts/forms'))) { $data = get_file_data($path . '/parts/forms/' . $form . '.php', apply_filters('piklist_get_file_data', array('class' => 'Class', 'title' => 'Title', 'method' => 'Method', 'action' => 'Action', 'filter' => 'Filter', 'id' => 'ID', 'capability' => 'Capability', 'logged_in' => 'Logged In'))); $data = apply_filters('piklist_add_part', $data, 'form'); if (!$data['logged_in'] || isset($data['logged_in']) && $data['logged_in'] == 'true' && is_user_logged_in()) { if (!$data['capability'] || $data['capability'] && current_user_can($data['capability'])) { $data['nonce'] = wp_create_nonce(plugin_basename(piklist::$paths['piklist'] . '/piklist.php')); $data['form'] = $path . '/parts/forms/' . $form; $data['ids'] = self::$save_ids; $data['form_id'] = $data['id'] ? $data['id'] : $form; self::$form_rendered = true; return piklist::render('fields/form', $data, true); } } } } } return null; }
public static function render_widget($null, $data) { piklist::render(self::$widgets[$data['id']]['file']); }
/** * 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); }
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>'; } } }
/** * 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))); }
/** * notices * Render notices for each individual field that has errors. * * @param string $form_id The form id. * @param bool $fetch Whether to return the notice or render it. * * @access public * @static * @since 1.0 */ public static function notices($form_id = null, $fetch = false) { if (!self::$form_submission) { return; } $submitted_form_id = piklist_form::get('form_id'); $errors = array(); foreach (self::$form_submission as $scope => $fields) { foreach ($fields as $field) { if ($field['errors']) { foreach ($field['errors'] as $error_messages) { $errors = array_merge($errors, $error_messages); } } } } $errors = array_unique($errors); if (($submitted_form_id && $form_id == $submitted_form_id || !$submitted_form_id) && !empty($errors) || $fetch) { $rendered_errors = array(); $content = '<ul>'; foreach ($errors as $error) { $content .= '<li>' . $error . '</li>'; } $content .= '</ul>'; $arguments = array('id' => 'piklist_validation_error', 'notice_type' => 'error', 'content' => $content); if ($fetch) { return piklist::render('shared/notice', $arguments, true); } else { piklist::render('shared/notice', $arguments); } } }
/** * widget * Render the front end view of the widget. * * @param array $arguments The part object. * @param array $instance The widget instance. * * @access public * @static * @since 1.0 */ public function widget($arguments, $instance) { extract($arguments); if (isset($instance['widget'])) { $widget = $instance['widget']; unset($instance['widget']); } if (isset($widget) && !empty($instance)) { $this->setup($this->widget_name); foreach ($instance as $field => &$value) { $value = maybe_unserialize($value); } $this->widgets[$widget]['instance'] = $instance; do_action('piklist_pre_render_widget', $this->widgets[$widget]); foreach ($this->widgets[$widget]['render'] as $render) { if (!strstr($render, '-form.php')) { piklist::render($render, array('instance' => $instance, 'settings' => $instance, 'before_widget' => str_replace('class="', 'class="' . piklist::dashes($this->widgets[$widget]['add_on'] . ' ' . $this->widgets[$widget]['id']) . ' ' . $this->widgets[$widget]['data']['class'] . ' ', $before_widget), 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title, 'data' => $this->widgets[$widget]['data'])); } } do_action('piklist_post_render_widget', $this->widgets[$widget]); } }
public static function piklist_site_inventory() { global $wp_version, $wpdb; $theme_data = wp_get_theme(); $theme = $theme_data->Name . ' ' . $theme_data->Version . '( ' . strip_tags($theme_data->author) . ' )'; $page_on_front_id = get_option('page_on_front'); $page_on_front = get_the_title($page_on_front_id) . ' (#' . $page_on_front_id . ')'; $page_for_posts_id = get_option('page_for_posts'); $page_for_posts = get_the_title($page_for_posts_id) . ' (#' . $page_for_posts_id . ')'; $table_prefix_length = strlen($wpdb->prefix); if (strlen($wpdb->prefix) > 16) { $table_prefix_status = sprintf(__('%1$sERRO: Too long%2$s', 'wp-helpers'), ' (', ')'); } else { $table_prefix_status = sprintf(__('%1$sAcceptable%2$s', 'wp-helpers'), ' (', ')'); } $wp_debug = defined('WP_DEBUG') ? WP_DEBUG ? __('Enabled', 'wp-helpers') . "\n" : __('Disabled', 'wp-helpers') . "\n" : __('Not set', 'wp-helpers'); $php_safe_mode = ini_get('safe_mode') ? __('Yes', 'wp-helpers') : __('No', 'wp-helpers'); $allow_url_fopen = ini_get('allow_url_fopen') ? __('Yes', 'wp-helpers') : __('No', 'wp-helpers'); $plugins_active = array(); $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { if (in_array($plugin_path, $active_plugins)) { $plugins_active[] = $plugin['Name'] . ': ' . $plugin['Version'] . ' (' . strip_tags($plugin['Author']) . ')'; } } // Widgets $all_widgets = ''; $sidebar_widgets = ''; $current_sidebar = ''; $active_widgets = get_option('sidebars_widgets'); if (is_array($active_widgets) && count($active_widgets)) { foreach ($active_widgets as $sidebar => $widgets) { if (is_array($widgets)) { if ($sidebar != $current_sidebar) { $sidebar_widgets .= $sidebar . ': '; $current_sidebar = $sidebar; } if (count($widgets)) { $sidebar_widgets .= implode(', ', $widgets); $all_widgets[] = $sidebar_widgets; } else { $sidebar_widgets .= __('(none)', 'piklist'); $all_widgets[] = $sidebar_widgets; } $sidebar_widgets = ''; } } } piklist::render('shared/system-info', array('theme' => $theme, 'wordpress_version' => get_bloginfo('version'), 'multisite' => is_multisite() ? __('WordPress Multisite', 'piklist') : __('WordPress (single user)', 'piklist'), 'permalinks' => get_option('permalink_structure') == '' ? $permalinks = __('Query String (index.php?p=123)', 'piklist') : ($permalinks = __('Pretty Permalinks', 'piklist')), 'page_on_front' => $page_on_front, 'page_for_posts' => $page_for_posts, 'table_prefix_status' => $table_prefix_status, 'table_prefix_length' => $table_prefix_length, 'wp_debug' => $wp_debug, 'users_can_register' => get_option('users_can_register') == '1' ? __('Yes', 'piklist') : __('No', 'piklist'), 'enable_xmlrpc' => get_option('enable_xmlrpc') == '1' ? __('Yes', 'piklist') : __('No', 'piklist'), 'enable_app' => get_option('enable_app') == '1' ? __('Yes', 'piklist') : __('No', 'piklist'), 'blog_public' => get_option('blog_public') == '1' ? __('Public', 'piklist') : __('Private', 'piklist'), 'rss_use_excerpt' => get_option('rss_use_excerpt') == '1' ? __('Summaries', 'piklist') : __('Full Content', 'piklist'), 'php_safe_mode' => $php_safe_mode, 'allow_url_fopen' => $allow_url_fopen, 'plugins_active' => $plugins_active, 'sidebar_widgets' => $all_widgets)); }
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>
$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 }
/** * 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; } } } }
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); } }
/** * piklist * The core helper function for the Piklist framework. * * @since 1.0 */ function piklist($option, $arguments = array()) { if (!is_array($arguments) && strstr($arguments, '=')) { parse_str($arguments, $arguments); } if (is_array($option) || is_object($option)) { return empty($arguments) ? piklist::object_format($option) : piklist::pluck($option, $arguments); } else { switch ($option) { case 'field': if (piklist_setting::get('active_section')) { piklist_setting::register_setting($arguments); } else { return piklist_form::render_field($arguments, isset($arguments['return']) ? $arguments['return'] : false); } break; case 'form': return piklist_form::render_form($arguments['form'], isset($arguments['add_on']) ? $arguments['add_on'] : null); break; case 'list_table': piklist_list_table::render($arguments); break; case 'post_type_labels': return piklist::post_type_labels($arguments); break; case 'taxonomy_labels': return piklist::taxonomy_labels($arguments); break; case 'option': case 'post_custom': case 'post_meta': case 'get_post_custom': case 'user_custom': case 'user_meta': case 'get_user_custom': case 'term_custom': case 'term_meta': case 'get_term_custom': switch ($option) { case 'user_custom': case 'user_meta': case 'get_user_custom': $type = 'user'; break; case 'term_custom': case 'term_meta': case 'get_term_custom': $type = 'term'; break; case 'post_custom': case 'post_meta': case 'get_post_custom': $type = 'post'; break; default: $type = 'option'; break; } return piklist::object($type, $arguments); break; case 'dashes': return piklist::dashes($arguments); break; case 'slug': return piklist::slug($arguments); break; case 'humanize': return piklist::humanize($arguments); break; case 'performance': piklist::performance(); break; case 'comments_template': $file = isset($arguments[0]) ? $arguments[0] : '/comments.php'; $seperate_comments = isset($arguments[1]) ? $arguments[1] : false; piklist_comments::comments_template($file, $seperate_comments); break; case 'include_meta_boxes': piklist::render('shared/notice', array('content' => sprintf(__('This page is using the old Piklist WorkFlow system. Please update your code to the %snew WorkFlow system%s.', 'piklist'), '<a href="https://piklist.com/user-guide/docs/building-workflows-piklist-v0-9-9/" target="_blank">', '</a>'), 'notice_type' => 'error')); break; case 'prefix': return piklist::$prefix; break; case 'url': return isset(piklist::$add_ons[$arguments]) ? piklist::$add_ons[$arguments]['url'] : null; break; case 'path': return isset(piklist::$add_ons[$arguments]) ? piklist::$add_ons[$arguments]['path'] : null; break; default: $return = isset($arguments['return']) ? $arguments['return'] : false; $loop = isset($arguments['loop']) ? $arguments['loop'] : null; unset($arguments['return']); unset($arguments['loop']); return piklist::render($option, $arguments, $return, $loop); break; } } }
/** * 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; }
/** * replace_deactivation_link_help * Checks whether to add help to the deactivation link. * * @return string The updated message. * * @access public * @static * @since 1.0 */ public static function replace_deactivation_link_help() { $message = piklist::render('shared/tooltip-help', array('message' => __('Piklist has disabled the deactivation link to protect your website. Either your theme or a plugin is dependent on Piklist. Please change your theme or deactivate the dependent plugin(s) to allow deactivation.', 'piklist')), true); return $message; }