repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
pods-framework/pods
classes/PodsAPI.php
PodsAPI.process_form
public function process_form( $params, $obj = null, $fields = null, $thank_you = null ) { $this->display_errors = false; $form = null; $nonce = pods_var( '_pods_nonce', $params ); $pod = pods_var( '_pods_pod', $params ); $id = pods_var( '_pods_id', $params ); $uri = pods_var( '_pods_uri', $params ); $form = pods_var( '_pods_form', $params ); $location = pods_var( '_pods_location', $params ); if ( is_object( $obj ) ) { $pod = $obj->pod; $id = $obj->id(); } if ( ! empty( $fields ) ) { $fields = array_keys( $fields ); $form = implode( ',', $fields ); } else { $fields = explode( ',', $form ); } if ( empty( $nonce ) || empty( $pod ) || empty( $uri ) || empty( $fields ) ) { return pods_error( __( 'Invalid submission', 'pods' ), $this ); } $uid = @session_id(); if ( is_user_logged_in() ) { $uid = 'user_' . get_current_user_id(); } $field_hash = wp_create_nonce( 'pods_fields_' . $form ); $action = 'pods_form_' . $pod . '_' . $uid . '_' . $id . '_' . $uri . '_' . $field_hash; if ( empty( $uid ) ) { return pods_error( __( 'Access denied for your session, please refresh and try again.', 'pods' ), $this ); } if ( false === wp_verify_nonce( $nonce, $action ) ) { return pods_error( __( 'Access denied, please refresh and try again.', 'pods' ), $this ); } $data = array(); foreach ( $fields as $field ) { $data[ $field ] = pods_var_raw( 'pods_field_' . $field, $params, '' ); } $params = array( 'pod' => $pod, 'id' => $id, 'data' => $data, 'from' => 'process_form', 'location' => $location ); $id = $this->save_pod_item( $params ); /** * Fires after the form has been processed and save_pod_item has run. * * @param int $id Item ID. * @param array $params save_pod_item parameters. * @param null|Pods $obj Pod object (if set). */ do_action( 'pods_api_processed_form', $id, $params, $obj ); // Always return $id for AJAX requests. if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { if ( 0 < $id && ! empty( $thank_you ) ) { $thank_you = str_replace( 'X_ID_X', $id, $thank_you ); pods_redirect( $thank_you, 302, false ); } } return $id; }
php
public function process_form( $params, $obj = null, $fields = null, $thank_you = null ) { $this->display_errors = false; $form = null; $nonce = pods_var( '_pods_nonce', $params ); $pod = pods_var( '_pods_pod', $params ); $id = pods_var( '_pods_id', $params ); $uri = pods_var( '_pods_uri', $params ); $form = pods_var( '_pods_form', $params ); $location = pods_var( '_pods_location', $params ); if ( is_object( $obj ) ) { $pod = $obj->pod; $id = $obj->id(); } if ( ! empty( $fields ) ) { $fields = array_keys( $fields ); $form = implode( ',', $fields ); } else { $fields = explode( ',', $form ); } if ( empty( $nonce ) || empty( $pod ) || empty( $uri ) || empty( $fields ) ) { return pods_error( __( 'Invalid submission', 'pods' ), $this ); } $uid = @session_id(); if ( is_user_logged_in() ) { $uid = 'user_' . get_current_user_id(); } $field_hash = wp_create_nonce( 'pods_fields_' . $form ); $action = 'pods_form_' . $pod . '_' . $uid . '_' . $id . '_' . $uri . '_' . $field_hash; if ( empty( $uid ) ) { return pods_error( __( 'Access denied for your session, please refresh and try again.', 'pods' ), $this ); } if ( false === wp_verify_nonce( $nonce, $action ) ) { return pods_error( __( 'Access denied, please refresh and try again.', 'pods' ), $this ); } $data = array(); foreach ( $fields as $field ) { $data[ $field ] = pods_var_raw( 'pods_field_' . $field, $params, '' ); } $params = array( 'pod' => $pod, 'id' => $id, 'data' => $data, 'from' => 'process_form', 'location' => $location ); $id = $this->save_pod_item( $params ); /** * Fires after the form has been processed and save_pod_item has run. * * @param int $id Item ID. * @param array $params save_pod_item parameters. * @param null|Pods $obj Pod object (if set). */ do_action( 'pods_api_processed_form', $id, $params, $obj ); // Always return $id for AJAX requests. if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { if ( 0 < $id && ! empty( $thank_you ) ) { $thank_you = str_replace( 'X_ID_X', $id, $thank_you ); pods_redirect( $thank_you, 302, false ); } } return $id; }
[ "public", "function", "process_form", "(", "$", "params", ",", "$", "obj", "=", "null", ",", "$", "fields", "=", "null", ",", "$", "thank_you", "=", "null", ")", "{", "$", "this", "->", "display_errors", "=", "false", ";", "$", "form", "=", "null", ...
Process a Pod-based form @param mixed $params @param object $obj Pod object @param array $fields Fields being submitted in form ( key => settings ) @param string $thank_you URL to send to upon success @return mixed @since 2.0.0
[ "Process", "a", "Pod", "-", "based", "form" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsAPI.php#L9084-L9166
train
pods-framework/pods
classes/PodsMigrate.php
PodsMigrate.str_getcsv
public function str_getcsv( $line, $delimiter = ',', $enclosure = '"', $escape = '\\' ) { $line = str_replace( "\r\n", "\n", $line ); $line = str_replace( "\r", "\n", $line ); if ( '\n' !== $delimiter && function_exists( 'str_getcsv' ) ) { return str_getcsv( $line, $delimiter, $enclosure, $escape ); } $delimiter = str_replace( '/', '\/', $delimiter ); $enclosure = preg_quote( $enclosure, '/' ); $split = "/{$delimiter}(?=(?:[^{$enclosure}]*{$enclosure}[^{$enclosure}]*{$enclosure})*(?![^{$enclosure}]*{$enclosure}))/"; $data = preg_split( $split, trim( $line ), - 1, PREG_SPLIT_NO_EMPTY ); if ( '\n' !== $delimiter ) { $data = preg_replace( "/^{$enclosure}(.*){$enclosure}$/s", '$1', $data ); } return $data; }
php
public function str_getcsv( $line, $delimiter = ',', $enclosure = '"', $escape = '\\' ) { $line = str_replace( "\r\n", "\n", $line ); $line = str_replace( "\r", "\n", $line ); if ( '\n' !== $delimiter && function_exists( 'str_getcsv' ) ) { return str_getcsv( $line, $delimiter, $enclosure, $escape ); } $delimiter = str_replace( '/', '\/', $delimiter ); $enclosure = preg_quote( $enclosure, '/' ); $split = "/{$delimiter}(?=(?:[^{$enclosure}]*{$enclosure}[^{$enclosure}]*{$enclosure})*(?![^{$enclosure}]*{$enclosure}))/"; $data = preg_split( $split, trim( $line ), - 1, PREG_SPLIT_NO_EMPTY ); if ( '\n' !== $delimiter ) { $data = preg_replace( "/^{$enclosure}(.*){$enclosure}$/s", '$1', $data ); } return $data; }
[ "public", "function", "str_getcsv", "(", "$", "line", ",", "$", "delimiter", "=", "','", ",", "$", "enclosure", "=", "'\"'", ",", "$", "escape", "=", "'\\\\'", ")", "{", "$", "line", "=", "str_replace", "(", "\"\\r\\n\"", ",", "\"\\n\"", ",", "$", "l...
Handle str_getcsv for cases where it's not set @param $line @param string $delimiter @param string $enclosure @param string $escape @return array|mixed
[ "Handle", "str_getcsv", "for", "cases", "where", "it", "s", "not", "set" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMigrate.php#L285-L306
train
pods-framework/pods
classes/PodsMigrate.php
PodsMigrate.export_data_to_file
public static function export_data_to_file( $file, $data, $single = false ) { $path = ABSPATH; // Detect path if it is set in the file param. if ( false !== strpos( $file, '/' ) ) { $path = dirname( $file ); $file = basename( $file ); } $format = 'json'; // Detect the export format. if ( false !== strpos( $file, '.' ) ) { $format = explode( '.', $file ); $format = end( $format ); } $migrate_data = array( 'items' => array( $data ), 'single' => $single, ); $migrate = new self( $format, null, $migrate_data ); // Handle processing the data into the format needed. $migrate->export(); $save_params = array( 'path' => $path, 'file' => $file, 'attach' => true, ); return $migrate->save( $save_params ); }
php
public static function export_data_to_file( $file, $data, $single = false ) { $path = ABSPATH; // Detect path if it is set in the file param. if ( false !== strpos( $file, '/' ) ) { $path = dirname( $file ); $file = basename( $file ); } $format = 'json'; // Detect the export format. if ( false !== strpos( $file, '.' ) ) { $format = explode( '.', $file ); $format = end( $format ); } $migrate_data = array( 'items' => array( $data ), 'single' => $single, ); $migrate = new self( $format, null, $migrate_data ); // Handle processing the data into the format needed. $migrate->export(); $save_params = array( 'path' => $path, 'file' => $file, 'attach' => true, ); return $migrate->save( $save_params ); }
[ "public", "static", "function", "export_data_to_file", "(", "$", "file", ",", "$", "data", ",", "$", "single", "=", "false", ")", "{", "$", "path", "=", "ABSPATH", ";", "// Detect path if it is set in the file param.", "if", "(", "false", "!==", "strpos", "(",...
Export data to a file. @param string $file File to export to. @param array $data Data to export. @param bool $single Whether this is a single item export. @return mixed
[ "Export", "data", "to", "a", "file", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMigrate.php#L1242-L1278
train
pods-framework/pods
classes/PodsMigrate.php
PodsMigrate.get_data_from_file
public static function get_data_from_file( $file, $single = false ) { $path = ABSPATH; // Detect path if it is set in the file param. if ( false !== strpos( $file, '/' ) ) { $path = dirname( $file ); $file = basename( $file ); } $format = 'json'; // Detect the export format. if ( false !== strpos( $file, '.' ) ) { $format = explode( '.', $file ); $format = end( $format ); } $migrate_data = array( 'single' => $single, ); $migrate = new self( $format, null, $migrate_data ); $raw_data = file_get_contents( $file ); // Handle processing the raw data from the format needed. $data = $migrate->parse( $raw_data ); return $data; }
php
public static function get_data_from_file( $file, $single = false ) { $path = ABSPATH; // Detect path if it is set in the file param. if ( false !== strpos( $file, '/' ) ) { $path = dirname( $file ); $file = basename( $file ); } $format = 'json'; // Detect the export format. if ( false !== strpos( $file, '.' ) ) { $format = explode( '.', $file ); $format = end( $format ); } $migrate_data = array( 'single' => $single, ); $migrate = new self( $format, null, $migrate_data ); $raw_data = file_get_contents( $file ); // Handle processing the raw data from the format needed. $data = $migrate->parse( $raw_data ); return $data; }
[ "public", "static", "function", "get_data_from_file", "(", "$", "file", ",", "$", "single", "=", "false", ")", "{", "$", "path", "=", "ABSPATH", ";", "// Detect path if it is set in the file param.", "if", "(", "false", "!==", "strpos", "(", "$", "file", ",", ...
Get data from a file. @param string $file File to get data from. @param bool $single Whether this is a single item. @return mixed
[ "Get", "data", "from", "a", "file", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMigrate.php#L1288-L1319
train
pods-framework/pods
components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Settings.php
Pods_Templates_Auto_Template_Settings.archive_warning
public function archive_warning() { // create $page variable to check if we are on pods admin page $page = pods_v( 'page', 'get', false, true ); // check if we are on Pods Admin page if ( $page === 'pods' ) { $archive_test = $this->archive_test(); if ( is_array( $archive_test ) ) { foreach ( $archive_test as $label => $test ) { if ( $test === 'fail' ) { echo sprintf( '<div id="message" class="error"><p>%s</p></div>', sprintf( __( 'The Pods post type %1$s has an archive template set to be displayed using Pods auto template, but the Pod does not have an archive. You can enable post type archives in the "Advanced Options" tab.', 'pods' ), $label ) ); } } } } }
php
public function archive_warning() { // create $page variable to check if we are on pods admin page $page = pods_v( 'page', 'get', false, true ); // check if we are on Pods Admin page if ( $page === 'pods' ) { $archive_test = $this->archive_test(); if ( is_array( $archive_test ) ) { foreach ( $archive_test as $label => $test ) { if ( $test === 'fail' ) { echo sprintf( '<div id="message" class="error"><p>%s</p></div>', sprintf( __( 'The Pods post type %1$s has an archive template set to be displayed using Pods auto template, but the Pod does not have an archive. You can enable post type archives in the "Advanced Options" tab.', 'pods' ), $label ) ); } } } } }
[ "public", "function", "archive_warning", "(", ")", "{", "// create $page variable to check if we are on pods admin page", "$", "page", "=", "pods_v", "(", "'page'", ",", "'get'", ",", "false", ",", "true", ")", ";", "// check if we are on Pods Admin page", "if", "(", ...
Throw admin warnings for post types that have archive templates set, but don't support archives @since 2.4.5
[ "Throw", "admin", "warnings", "for", "post", "types", "that", "have", "archive", "templates", "set", "but", "don", "t", "support", "archives" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Settings.php#L351-L368
train
pods-framework/pods
components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Settings.php
Pods_Templates_Auto_Template_Settings.get_template_titles
public function get_template_titles() { static $template_titles; if ( empty( $template_titles ) ) { $all_templates = (array) pods_api()->load_templates( array() ); $template_titles = array(); foreach ( $all_templates as $template ) { $template_titles[] = $template['name']; } } return $template_titles; }
php
public function get_template_titles() { static $template_titles; if ( empty( $template_titles ) ) { $all_templates = (array) pods_api()->load_templates( array() ); $template_titles = array(); foreach ( $all_templates as $template ) { $template_titles[] = $template['name']; } } return $template_titles; }
[ "public", "function", "get_template_titles", "(", ")", "{", "static", "$", "template_titles", ";", "if", "(", "empty", "(", "$", "template_titles", ")", ")", "{", "$", "all_templates", "=", "(", "array", ")", "pods_api", "(", ")", "->", "load_templates", "...
Get titles of all Pods Templates @return string[] Array of template names @since 2.4.5
[ "Get", "titles", "of", "all", "Pods", "Templates" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Templates/includes/auto-template/Pods_Templates_Auto_Template_Settings.php#L377-L393
train
pods-framework/pods
classes/PodsMeta.php
PodsMeta.cache_pods
public function cache_pods() { self::$advanced_content_types = pods_api()->load_pods( array( 'type' => 'pod', 'refresh' => true ) ); self::$post_types = pods_api()->load_pods( array( 'type' => 'post_type', 'refresh' => true ) ); self::$taxonomies = pods_api()->load_pods( array( 'type' => 'taxonomy', 'refresh' => true ) ); self::$media = pods_api()->load_pods( array( 'type' => 'media', 'refresh' => true ) ); self::$user = pods_api()->load_pods( array( 'type' => 'user', 'refresh' => true ) ); self::$comment = pods_api()->load_pods( array( 'type' => 'comment', 'refresh' => true ) ); self::$settings = pods_api()->load_pods( array( 'type' => 'settings', 'refresh' => true ) ); }
php
public function cache_pods() { self::$advanced_content_types = pods_api()->load_pods( array( 'type' => 'pod', 'refresh' => true ) ); self::$post_types = pods_api()->load_pods( array( 'type' => 'post_type', 'refresh' => true ) ); self::$taxonomies = pods_api()->load_pods( array( 'type' => 'taxonomy', 'refresh' => true ) ); self::$media = pods_api()->load_pods( array( 'type' => 'media', 'refresh' => true ) ); self::$user = pods_api()->load_pods( array( 'type' => 'user', 'refresh' => true ) ); self::$comment = pods_api()->load_pods( array( 'type' => 'comment', 'refresh' => true ) ); self::$settings = pods_api()->load_pods( array( 'type' => 'settings', 'refresh' => true ) ); }
[ "public", "function", "cache_pods", "(", ")", "{", "self", "::", "$", "advanced_content_types", "=", "pods_api", "(", ")", "->", "load_pods", "(", "array", "(", "'type'", "=>", "'pod'", ",", "'refresh'", "=>", "true", ")", ")", ";", "self", "::", "$", ...
Go back through and cache the Pods now that Polylang has loaded
[ "Go", "back", "through", "and", "cache", "the", "Pods", "now", "that", "Polylang", "has", "loaded" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMeta.php#L339-L348
train
pods-framework/pods
classes/PodsMeta.php
PodsMeta.save_post_detect_new
public function save_post_detect_new( $new_status, $old_status, $post ) { if ( $post ) { self::$old_post_status[ $post->post_type ] = $old_status; } }
php
public function save_post_detect_new( $new_status, $old_status, $post ) { if ( $post ) { self::$old_post_status[ $post->post_type ] = $old_status; } }
[ "public", "function", "save_post_detect_new", "(", "$", "new_status", ",", "$", "old_status", ",", "$", "post", ")", "{", "if", "(", "$", "post", ")", "{", "self", "::", "$", "old_post_status", "[", "$", "post", "->", "post_type", "]", "=", "$", "old_s...
Handle integration with the transition_post_status hook @see wp_transition_post_status @param string $new_status @param string $old_status @param WP_Post $post
[ "Handle", "integration", "with", "the", "transition_post_status", "hook" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMeta.php#L1240-L1246
train
pods-framework/pods
classes/PodsMeta.php
PodsMeta.save_post_track_changed_fields
public function save_post_track_changed_fields( $data, $postarr ) { $no_conflict = pods_no_conflict_check( 'post' ); if ( ! $no_conflict && ! empty( $data['post_type'] ) && ! empty( $postarr['ID'] ) ) { $pod = $data['post_type']; $id = $postarr['ID']; PodsAPI::handle_changed_fields( $pod, $id, 'reset' ); } return $data; }
php
public function save_post_track_changed_fields( $data, $postarr ) { $no_conflict = pods_no_conflict_check( 'post' ); if ( ! $no_conflict && ! empty( $data['post_type'] ) && ! empty( $postarr['ID'] ) ) { $pod = $data['post_type']; $id = $postarr['ID']; PodsAPI::handle_changed_fields( $pod, $id, 'reset' ); } return $data; }
[ "public", "function", "save_post_track_changed_fields", "(", "$", "data", ",", "$", "postarr", ")", "{", "$", "no_conflict", "=", "pods_no_conflict_check", "(", "'post'", ")", ";", "if", "(", "!", "$", "no_conflict", "&&", "!", "empty", "(", "$", "data", "...
Track changed fields before save for posts. @param array $data @param array $postarr @return array
[ "Track", "changed", "fields", "before", "save", "for", "posts", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMeta.php#L1413-L1426
train
pods-framework/pods
classes/PodsMeta.php
PodsMeta.save_taxonomy_track_changed_fields
public function save_taxonomy_track_changed_fields( $term_id, $taxonomy ) { $no_conflict = pods_no_conflict_check( 'term' ); if ( ! $no_conflict ) { $pod = $taxonomy; $id = $term_id; PodsAPI::handle_changed_fields( $pod, $id, 'reset' ); } }
php
public function save_taxonomy_track_changed_fields( $term_id, $taxonomy ) { $no_conflict = pods_no_conflict_check( 'term' ); if ( ! $no_conflict ) { $pod = $taxonomy; $id = $term_id; PodsAPI::handle_changed_fields( $pod, $id, 'reset' ); } }
[ "public", "function", "save_taxonomy_track_changed_fields", "(", "$", "term_id", ",", "$", "taxonomy", ")", "{", "$", "no_conflict", "=", "pods_no_conflict_check", "(", "'term'", ")", ";", "if", "(", "!", "$", "no_conflict", ")", "{", "$", "pod", "=", "$", ...
Track changed fields before save for terms. @param int $term_id @param string $taxonomy
[ "Track", "changed", "fields", "before", "save", "for", "terms", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMeta.php#L1858-L1869
train
pods-framework/pods
classes/PodsMeta.php
PodsMeta.save_user_track_changed_fields
public function save_user_track_changed_fields( $user_login ) { $no_conflict = pods_no_conflict_check( 'user' ); if ( ! $no_conflict ) { $user = get_user_by( 'login', $user_login ); if ( $user && ! is_wp_error( $user ) ) { $pod = 'user'; $id = $user->ID; PodsAPI::handle_changed_fields( $pod, $id, 'reset' ); } } return $user_login; }
php
public function save_user_track_changed_fields( $user_login ) { $no_conflict = pods_no_conflict_check( 'user' ); if ( ! $no_conflict ) { $user = get_user_by( 'login', $user_login ); if ( $user && ! is_wp_error( $user ) ) { $pod = 'user'; $id = $user->ID; PodsAPI::handle_changed_fields( $pod, $id, 'reset' ); } } return $user_login; }
[ "public", "function", "save_user_track_changed_fields", "(", "$", "user_login", ")", "{", "$", "no_conflict", "=", "pods_no_conflict_check", "(", "'user'", ")", ";", "if", "(", "!", "$", "no_conflict", ")", "{", "$", "user", "=", "get_user_by", "(", "'login'",...
Track changed fields before save for users. @param string $user_login @return string
[ "Track", "changed", "fields", "before", "save", "for", "users", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMeta.php#L2079-L2096
train
pods-framework/pods
classes/PodsMeta.php
PodsMeta.save_comment_track_changed_fields
public function save_comment_track_changed_fields( $data, $comment, $commentarr ) { $no_conflict = pods_no_conflict_check( 'user' ); if ( ! $no_conflict && ! empty( $comment['comment_type'] ) && ! empty( $comment['comment_ID'] ) ) { $pod = $comment['comment_type']; $id = $comment['comment_ID']; PodsAPI::handle_changed_fields( $pod, $id, 'reset' ); } return $data; }
php
public function save_comment_track_changed_fields( $data, $comment, $commentarr ) { $no_conflict = pods_no_conflict_check( 'user' ); if ( ! $no_conflict && ! empty( $comment['comment_type'] ) && ! empty( $comment['comment_ID'] ) ) { $pod = $comment['comment_type']; $id = $comment['comment_ID']; PodsAPI::handle_changed_fields( $pod, $id, 'reset' ); } return $data; }
[ "public", "function", "save_comment_track_changed_fields", "(", "$", "data", ",", "$", "comment", ",", "$", "commentarr", ")", "{", "$", "no_conflict", "=", "pods_no_conflict_check", "(", "'user'", ")", ";", "if", "(", "!", "$", "no_conflict", "&&", "!", "em...
Track changed fields before save for comments. @param array $data The new, processed comment data. @param array $comment The old, unslashed comment data. @param array $commentarr The new, raw comment data. @return array
[ "Track", "changed", "fields", "before", "save", "for", "comments", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMeta.php#L2524-L2537
train
pods-framework/pods
classes/PodsMeta.php
PodsMeta.split_shared_term
public static function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { require_once( PODS_DIR . 'classes/PodsTermSplitting.php' ); $term_splitting = new Pods_Term_Splitting( $term_id, $new_term_id, $taxonomy ); $term_splitting->split_shared_term(); }
php
public static function split_shared_term( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) { require_once( PODS_DIR . 'classes/PodsTermSplitting.php' ); $term_splitting = new Pods_Term_Splitting( $term_id, $new_term_id, $taxonomy ); $term_splitting->split_shared_term(); }
[ "public", "static", "function", "split_shared_term", "(", "$", "term_id", ",", "$", "new_term_id", ",", "$", "term_taxonomy_id", ",", "$", "taxonomy", ")", "{", "require_once", "(", "PODS_DIR", ".", "'classes/PodsTermSplitting.php'", ")", ";", "$", "term_splitting...
Hook the split_shared_term action and point it to this method Fires after a previously shared taxonomy term is split into two separate terms. @param int $term_id ID of the formerly shared term. @param int $new_term_id ID of the new term created for the $term_taxonomy_id. @param int $term_taxonomy_id ID for the term_taxonomy row affected by the split. @param string $taxonomy Taxonomy for the split term.
[ "Hook", "the", "split_shared_term", "action", "and", "point", "it", "to", "this", "method" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsMeta.php#L3376-L3383
train
pods-framework/pods
components/Templates/class-pods_templates.php
Pods_Templates_Frontier.enqueue_admin_stylescripts
public function enqueue_admin_stylescripts() { $screen = get_current_screen(); if ( ! isset( $this->plugin_screen_hook_suffix ) ) { return; } if ( in_array( $screen->id, $this->plugin_screen_hook_suffix, true ) ) { $slug = array_search( $screen->id, $this->plugin_screen_hook_suffix ); // $configfiles = glob( $this->get_path( __FILE__ ) .'configs/'.$slug.'-*.php' ); if ( file_exists( $this->get_path( __FILE__ ) . 'configs/fieldgroups-' . $slug . '.php' ) ) { include $this->get_path( __FILE__ ) . 'configs/fieldgroups-' . $slug . '.php'; } if ( ! empty( $configfiles ) ) { foreach ( $configfiles as $key => $fieldfile ) { include $fieldfile; if ( ! empty( $group['scripts'] ) ) { foreach ( $group['scripts'] as $script ) { wp_enqueue_script( $this->plugin_slug . '-' . strtok( $script, '.' ), $this->get_url( 'assets/js/' . $script, __FILE__ ), array( 'jquery' ) ); } } if ( ! empty( $group['styles'] ) ) { foreach ( $group['styles'] as $style ) { wp_enqueue_style( $this->plugin_slug . '-' . strtok( $style, '.' ), $this->get_url( 'assets/css/' . $style, __FILE__ ) ); } } } } wp_enqueue_style( $this->plugin_slug . '-admin-styles', $this->get_url( 'assets/css/panel.css', __FILE__ ), array(), self::VERSION ); wp_enqueue_style( 'pods-codemirror' ); wp_enqueue_script( $this->plugin_slug . '-admin-scripts', $this->get_url( 'assets/js/panel.js', __FILE__ ), array(), self::VERSION ); wp_enqueue_script( 'pods_codemirror' ); wp_enqueue_script( 'pods-codemirror-overlay' ); wp_enqueue_script( 'pods-codemirror-hints' ); wp_enqueue_script( $this->plugin_slug . '-cm-editor', $this->get_url( 'assets/js/editor1.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); wp_enqueue_script( 'pods-codemirror-mode-xml' ); wp_enqueue_script( 'pods-codemirror-mode-html' ); wp_enqueue_script( 'pods-codemirror-mode-css' ); }//end if }
php
public function enqueue_admin_stylescripts() { $screen = get_current_screen(); if ( ! isset( $this->plugin_screen_hook_suffix ) ) { return; } if ( in_array( $screen->id, $this->plugin_screen_hook_suffix, true ) ) { $slug = array_search( $screen->id, $this->plugin_screen_hook_suffix ); // $configfiles = glob( $this->get_path( __FILE__ ) .'configs/'.$slug.'-*.php' ); if ( file_exists( $this->get_path( __FILE__ ) . 'configs/fieldgroups-' . $slug . '.php' ) ) { include $this->get_path( __FILE__ ) . 'configs/fieldgroups-' . $slug . '.php'; } if ( ! empty( $configfiles ) ) { foreach ( $configfiles as $key => $fieldfile ) { include $fieldfile; if ( ! empty( $group['scripts'] ) ) { foreach ( $group['scripts'] as $script ) { wp_enqueue_script( $this->plugin_slug . '-' . strtok( $script, '.' ), $this->get_url( 'assets/js/' . $script, __FILE__ ), array( 'jquery' ) ); } } if ( ! empty( $group['styles'] ) ) { foreach ( $group['styles'] as $style ) { wp_enqueue_style( $this->plugin_slug . '-' . strtok( $style, '.' ), $this->get_url( 'assets/css/' . $style, __FILE__ ) ); } } } } wp_enqueue_style( $this->plugin_slug . '-admin-styles', $this->get_url( 'assets/css/panel.css', __FILE__ ), array(), self::VERSION ); wp_enqueue_style( 'pods-codemirror' ); wp_enqueue_script( $this->plugin_slug . '-admin-scripts', $this->get_url( 'assets/js/panel.js', __FILE__ ), array(), self::VERSION ); wp_enqueue_script( 'pods_codemirror' ); wp_enqueue_script( 'pods-codemirror-overlay' ); wp_enqueue_script( 'pods-codemirror-hints' ); wp_enqueue_script( $this->plugin_slug . '-cm-editor', $this->get_url( 'assets/js/editor1.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); wp_enqueue_script( 'pods-codemirror-mode-xml' ); wp_enqueue_script( 'pods-codemirror-mode-html' ); wp_enqueue_script( 'pods-codemirror-mode-css' ); }//end if }
[ "public", "function", "enqueue_admin_stylescripts", "(", ")", "{", "$", "screen", "=", "get_current_screen", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "plugin_screen_hook_suffix", ")", ")", "{", "return", ";", "}", "if", "(", "in_arra...
Register and enqueue admin-specific style sheet. @return null
[ "Register", "and", "enqueue", "admin", "-", "specific", "style", "sheet", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Templates/class-pods_templates.php#L94-L137
train
pods-framework/pods
components/Templates/class-pods_templates.php
Pods_Templates_Frontier.add_metaboxes
public function add_metaboxes( $slug, $post = false ) { if ( ! empty( $post ) ) { if ( ! in_array( $post->post_type, array( '_pods_template' ), true ) ) { return; } } else { $screen = get_current_screen(); if ( ! in_array( $screen->base, array( '_pods_template' ), true ) ) { return; } } $this->plugin_screen_hook_suffix[ $slug ] = $slug; // Required Styles for metabox wp_enqueue_style( $this->plugin_slug . '-view_template-styles', $this->get_url( 'assets/css/styles-view_template.css', __FILE__ ), array(), self::VERSION ); // Required scripts for metabox wp_enqueue_script( 'jquery-ui-resizable' ); wp_enqueue_script( $this->plugin_slug . '-handlebarsjs', $this->get_url( 'assets/js/handlebars2.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); wp_enqueue_script( $this->plugin_slug . '-baldrickjs', $this->get_url( 'assets/js/jquery.baldrick3.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); wp_enqueue_script( $this->plugin_slug . '-handlebars-baldrick', $this->get_url( 'assets/js/handlebars.baldrick2.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); wp_enqueue_style( $this->plugin_slug . '-pod_reference-styles', $this->get_url( 'assets/css/styles-pod_reference.css', __FILE__ ), array(), self::VERSION ); // add metabox add_meta_box( 'view_template', __( 'Template', 'pods' ), array( $this, 'render_metaboxes_custom', ), '_pods_template', 'normal', 'high', array( 'slug' => 'view_template', 'groups' => array(), ) ); add_meta_box( 'pod_reference', __( 'Pod Reference', 'pods' ), array( $this, 'render_metaboxes_custom', ), '_pods_template', 'side', 'default', array( 'slug' => 'pod_reference', 'groups' => array(), ) ); }
php
public function add_metaboxes( $slug, $post = false ) { if ( ! empty( $post ) ) { if ( ! in_array( $post->post_type, array( '_pods_template' ), true ) ) { return; } } else { $screen = get_current_screen(); if ( ! in_array( $screen->base, array( '_pods_template' ), true ) ) { return; } } $this->plugin_screen_hook_suffix[ $slug ] = $slug; // Required Styles for metabox wp_enqueue_style( $this->plugin_slug . '-view_template-styles', $this->get_url( 'assets/css/styles-view_template.css', __FILE__ ), array(), self::VERSION ); // Required scripts for metabox wp_enqueue_script( 'jquery-ui-resizable' ); wp_enqueue_script( $this->plugin_slug . '-handlebarsjs', $this->get_url( 'assets/js/handlebars2.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); wp_enqueue_script( $this->plugin_slug . '-baldrickjs', $this->get_url( 'assets/js/jquery.baldrick3.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); wp_enqueue_script( $this->plugin_slug . '-handlebars-baldrick', $this->get_url( 'assets/js/handlebars.baldrick2.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); wp_enqueue_style( $this->plugin_slug . '-pod_reference-styles', $this->get_url( 'assets/css/styles-pod_reference.css', __FILE__ ), array(), self::VERSION ); // add metabox add_meta_box( 'view_template', __( 'Template', 'pods' ), array( $this, 'render_metaboxes_custom', ), '_pods_template', 'normal', 'high', array( 'slug' => 'view_template', 'groups' => array(), ) ); add_meta_box( 'pod_reference', __( 'Pod Reference', 'pods' ), array( $this, 'render_metaboxes_custom', ), '_pods_template', 'side', 'default', array( 'slug' => 'pod_reference', 'groups' => array(), ) ); }
[ "public", "function", "add_metaboxes", "(", "$", "slug", ",", "$", "post", "=", "false", ")", "{", "if", "(", "!", "empty", "(", "$", "post", ")", ")", "{", "if", "(", "!", "in_array", "(", "$", "post", "->", "post_type", ",", "array", "(", "'_po...
setup meta boxes. @param $slug @param bool $post @return null
[ "setup", "meta", "boxes", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Templates/class-pods_templates.php#L180-L225
train
pods-framework/pods
components/Templates/class-pods_templates.php
Pods_Templates_Frontier.render_metaboxes_custom
public function render_metaboxes_custom( $post, $args ) { // include the metabox view echo '<input type="hidden" name="pods_templates_metabox" id="pods_templates_metabox" value="' . esc_attr( wp_create_nonce( plugin_basename( __FILE__ ) ) ) . '" />'; echo '<input type="hidden" name="pods_templates_metabox_prefix[]" value="' . esc_attr( $args['args']['slug'] ) . '" />'; // get post meta to $atts $ post content - ir the widget option if ( ! empty( $post ) ) { $atts = get_post_meta( $post->ID, $args['args']['slug'], true ); $content = $post->post_content; } else { $atts = get_option( $args['args']['slug'] ); $content = ''; } if ( file_exists( $this->get_path( __FILE__ ) . 'includes/element-' . $args['args']['slug'] . '.php' ) ) { include $this->get_path( __FILE__ ) . 'includes/element-' . $args['args']['slug'] . '.php'; } elseif ( file_exists( $this->get_path( __FILE__ ) . 'includes/element-' . $args['args']['slug'] . '.html' ) ) { include $this->get_path( __FILE__ ) . 'includes/element-' . $args['args']['slug'] . '.html'; } // add script if ( file_exists( $this->get_path( __FILE__ ) . 'assets/js/scripts-' . $args['args']['slug'] . '.php' ) ) { echo "<script type=\"text/javascript\">\r\n"; include $this->get_path( __FILE__ ) . 'assets/js/scripts-' . $args['args']['slug'] . '.php'; echo "</script>\r\n"; } elseif ( file_exists( $this->get_path( __FILE__ ) . 'assets/js/scripts-' . $args['args']['slug'] . '.js' ) ) { wp_enqueue_script( $this->plugin_slug . '-' . $args['args']['slug'] . '-script', $this->get_url( 'assets/js/scripts-' . $args['args']['slug'] . '.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); } }
php
public function render_metaboxes_custom( $post, $args ) { // include the metabox view echo '<input type="hidden" name="pods_templates_metabox" id="pods_templates_metabox" value="' . esc_attr( wp_create_nonce( plugin_basename( __FILE__ ) ) ) . '" />'; echo '<input type="hidden" name="pods_templates_metabox_prefix[]" value="' . esc_attr( $args['args']['slug'] ) . '" />'; // get post meta to $atts $ post content - ir the widget option if ( ! empty( $post ) ) { $atts = get_post_meta( $post->ID, $args['args']['slug'], true ); $content = $post->post_content; } else { $atts = get_option( $args['args']['slug'] ); $content = ''; } if ( file_exists( $this->get_path( __FILE__ ) . 'includes/element-' . $args['args']['slug'] . '.php' ) ) { include $this->get_path( __FILE__ ) . 'includes/element-' . $args['args']['slug'] . '.php'; } elseif ( file_exists( $this->get_path( __FILE__ ) . 'includes/element-' . $args['args']['slug'] . '.html' ) ) { include $this->get_path( __FILE__ ) . 'includes/element-' . $args['args']['slug'] . '.html'; } // add script if ( file_exists( $this->get_path( __FILE__ ) . 'assets/js/scripts-' . $args['args']['slug'] . '.php' ) ) { echo "<script type=\"text/javascript\">\r\n"; include $this->get_path( __FILE__ ) . 'assets/js/scripts-' . $args['args']['slug'] . '.php'; echo "</script>\r\n"; } elseif ( file_exists( $this->get_path( __FILE__ ) . 'assets/js/scripts-' . $args['args']['slug'] . '.js' ) ) { wp_enqueue_script( $this->plugin_slug . '-' . $args['args']['slug'] . '-script', $this->get_url( 'assets/js/scripts-' . $args['args']['slug'] . '.js', __FILE__ ), array( 'jquery' ), self::VERSION, true ); } }
[ "public", "function", "render_metaboxes_custom", "(", "$", "post", ",", "$", "args", ")", "{", "// include the metabox view", "echo", "'<input type=\"hidden\" name=\"pods_templates_metabox\" id=\"pods_templates_metabox\" value=\"'", ".", "esc_attr", "(", "wp_create_nonce", "(", ...
render template based meta boxes. @param $post @param $args @return null
[ "render", "template", "based", "meta", "boxes", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Templates/class-pods_templates.php#L235-L264
train
pods-framework/pods
components/Templates/class-pods_templates.php
Pods_Templates_Frontier.save_post_metaboxes
public function save_post_metaboxes( $pid, $post ) { if ( ! isset( $_POST['pods_templates_metabox'] ) || ! isset( $_POST['pods_templates_metabox_prefix'] ) ) { return; } if ( ! wp_verify_nonce( $_POST['pods_templates_metabox'], plugin_basename( __FILE__ ) ) ) { return $post->ID; } if ( ! current_user_can( 'edit_post', $post->ID ) ) { return $post->ID; } if ( $post->post_type == 'revision' ) { return; } foreach ( $_POST['pods_templates_metabox_prefix'] as $prefix ) { if ( ! isset( $_POST[ $prefix ] ) ) { continue; } delete_post_meta( $post->ID, $prefix ); add_post_meta( $post->ID, $prefix, $_POST[ $prefix ] ); } }
php
public function save_post_metaboxes( $pid, $post ) { if ( ! isset( $_POST['pods_templates_metabox'] ) || ! isset( $_POST['pods_templates_metabox_prefix'] ) ) { return; } if ( ! wp_verify_nonce( $_POST['pods_templates_metabox'], plugin_basename( __FILE__ ) ) ) { return $post->ID; } if ( ! current_user_can( 'edit_post', $post->ID ) ) { return $post->ID; } if ( $post->post_type == 'revision' ) { return; } foreach ( $_POST['pods_templates_metabox_prefix'] as $prefix ) { if ( ! isset( $_POST[ $prefix ] ) ) { continue; } delete_post_meta( $post->ID, $prefix ); add_post_meta( $post->ID, $prefix, $_POST[ $prefix ] ); } }
[ "public", "function", "save_post_metaboxes", "(", "$", "pid", ",", "$", "post", ")", "{", "if", "(", "!", "isset", "(", "$", "_POST", "[", "'pods_templates_metabox'", "]", ")", "||", "!", "isset", "(", "$", "_POST", "[", "'pods_templates_metabox_prefix'", ...
save metabox data @param $pid @param $post
[ "save", "metabox", "data" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Templates/class-pods_templates.php#L272-L296
train
pods-framework/pods
components/Templates/class-pods_templates.php
Pods_Templates_Frontier.element_instance_id
public function element_instance_id( $id, $process ) { $this->element_instances[ $id ][ $process ][] = true; $count = count( $this->element_instances[ $id ][ $process ] ); if ( $count > 1 ) { return $id . ( $count - 1 ); } return $id; }
php
public function element_instance_id( $id, $process ) { $this->element_instances[ $id ][ $process ][] = true; $count = count( $this->element_instances[ $id ][ $process ] ); if ( $count > 1 ) { return $id . ( $count - 1 ); } return $id; }
[ "public", "function", "element_instance_id", "(", "$", "id", ",", "$", "process", ")", "{", "$", "this", "->", "element_instances", "[", "$", "id", "]", "[", "$", "process", "]", "[", "]", "=", "true", ";", "$", "count", "=", "count", "(", "$", "th...
create and register an instance ID @param $id @param $process @return string
[ "create", "and", "register", "an", "instance", "ID" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Templates/class-pods_templates.php#L306-L315
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.register_related_object
public function register_related_object( $name, $label, $options = null ) { if ( empty( $name ) || empty( $label ) ) { return false; } $related_object = array( 'label' => $label, 'group' => 'Custom Relationships', 'simple' => true, 'bidirectional' => false, 'data' => array(), 'data_callback' => null, ); $related_object = array_merge( $related_object, $options ); self::$custom_related_objects[ $name ] = $related_object; return true; }
php
public function register_related_object( $name, $label, $options = null ) { if ( empty( $name ) || empty( $label ) ) { return false; } $related_object = array( 'label' => $label, 'group' => 'Custom Relationships', 'simple' => true, 'bidirectional' => false, 'data' => array(), 'data_callback' => null, ); $related_object = array_merge( $related_object, $options ); self::$custom_related_objects[ $name ] = $related_object; return true; }
[ "public", "function", "register_related_object", "(", "$", "name", ",", "$", "label", ",", "$", "options", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "name", ")", "||", "empty", "(", "$", "label", ")", ")", "{", "return", "false", ";", "}...
Register a related object. @param string $name Object name. @param string $label Object label. @param array $options Object options. @return array|boolean Object array or false if unsuccessful @since 2.3.0
[ "Register", "a", "related", "object", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L334-L355
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.related_objects
public function related_objects( $force = false ) { if ( $this->setup_related_objects( $force ) || null === self::$names_related ) { $related_objects = array(); foreach ( self::$related_objects as $related_object_name => $related_object ) { if ( ! isset( $related_objects[ $related_object['group'] ] ) ) { $related_objects[ $related_object['group'] ] = array(); } $related_objects[ $related_object['group'] ][ $related_object_name ] = $related_object['label']; } self::$names_related = (array) apply_filters( 'pods_form_ui_field_pick_related_objects', $related_objects ); } return self::$names_related; }
php
public function related_objects( $force = false ) { if ( $this->setup_related_objects( $force ) || null === self::$names_related ) { $related_objects = array(); foreach ( self::$related_objects as $related_object_name => $related_object ) { if ( ! isset( $related_objects[ $related_object['group'] ] ) ) { $related_objects[ $related_object['group'] ] = array(); } $related_objects[ $related_object['group'] ][ $related_object_name ] = $related_object['label']; } self::$names_related = (array) apply_filters( 'pods_form_ui_field_pick_related_objects', $related_objects ); } return self::$names_related; }
[ "public", "function", "related_objects", "(", "$", "force", "=", "false", ")", "{", "if", "(", "$", "this", "->", "setup_related_objects", "(", "$", "force", ")", "||", "null", "===", "self", "::", "$", "names_related", ")", "{", "$", "related_objects", ...
Return available related objects @param boolean $force Whether to force refresh of related objects. @return array Field selection array @since 2.3.0
[ "Return", "available", "related", "objects" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L609-L627
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.simple_objects
public function simple_objects() { if ( $this->setup_related_objects() || null === self::$names_simple ) { $simple_objects = array(); foreach ( self::$related_objects as $object => $related_object ) { if ( ! isset( $related_object['simple'] ) || ! $related_object['simple'] ) { continue; } $simple_objects[] = $object; } self::$names_simple = (array) apply_filters( 'pods_form_ui_field_pick_simple_objects', $simple_objects ); } return self::$names_simple; }
php
public function simple_objects() { if ( $this->setup_related_objects() || null === self::$names_simple ) { $simple_objects = array(); foreach ( self::$related_objects as $object => $related_object ) { if ( ! isset( $related_object['simple'] ) || ! $related_object['simple'] ) { continue; } $simple_objects[] = $object; } self::$names_simple = (array) apply_filters( 'pods_form_ui_field_pick_simple_objects', $simple_objects ); } return self::$names_simple; }
[ "public", "function", "simple_objects", "(", ")", "{", "if", "(", "$", "this", "->", "setup_related_objects", "(", ")", "||", "null", "===", "self", "::", "$", "names_simple", ")", "{", "$", "simple_objects", "=", "array", "(", ")", ";", "foreach", "(", ...
Return available simple object names @return array Simple object names @since 2.3.0
[ "Return", "available", "simple", "object", "names" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L635-L653
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.bidirectional_objects
public function bidirectional_objects() { if ( $this->setup_related_objects() || null === self::$names_bidirectional ) { $bidirectional_objects = array(); foreach ( self::$related_objects as $object => $related_object ) { if ( ! isset( $related_object['bidirectional'] ) || ! $related_object['bidirectional'] ) { continue; } $bidirectional_objects[] = $object; } self::$names_bidirectional = (array) apply_filters( 'pods_form_ui_field_pick_bidirectional_objects', $bidirectional_objects ); } return self::$names_bidirectional; }
php
public function bidirectional_objects() { if ( $this->setup_related_objects() || null === self::$names_bidirectional ) { $bidirectional_objects = array(); foreach ( self::$related_objects as $object => $related_object ) { if ( ! isset( $related_object['bidirectional'] ) || ! $related_object['bidirectional'] ) { continue; } $bidirectional_objects[] = $object; } self::$names_bidirectional = (array) apply_filters( 'pods_form_ui_field_pick_bidirectional_objects', $bidirectional_objects ); } return self::$names_bidirectional; }
[ "public", "function", "bidirectional_objects", "(", ")", "{", "if", "(", "$", "this", "->", "setup_related_objects", "(", ")", "||", "null", "===", "self", "::", "$", "names_bidirectional", ")", "{", "$", "bidirectional_objects", "=", "array", "(", ")", ";",...
Return available bidirectional object names @return array Bidirectional object names @since 2.3.4
[ "Return", "available", "bidirectional", "object", "names" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L661-L679
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.build_dfv_autocomplete_ajax_data
public function build_dfv_autocomplete_ajax_data( $options, $args, $ajax = false ) { if ( is_object( $args->pod ) ) { $pod_id = (int) $args->pod->pod_id; } else { $pod_id = 0; } $field_id = (int) $options['id']; $id = (int) $args->id; if ( is_user_logged_in() ) { $uid = 'user_' . get_current_user_id(); } else { $uid = @session_id(); } $uri_hash = wp_create_nonce( 'pods_uri_' . $_SERVER['REQUEST_URI'] ); $field_nonce = wp_create_nonce( 'pods_relationship_' . $pod_id . '_' . $uid . '_' . $uri_hash . '_' . $field_id ); // Values can be overridden via the `pods_field_dfv_data` filter in $data['fieldConfig']['ajax_data']. return array( 'ajax' => $ajax, 'delay' => 300, 'minimum_input_length' => 1, 'pod' => $pod_id, 'field' => $field_id, 'id' => $id, 'uri' => $uri_hash, '_wpnonce' => $field_nonce, ); }
php
public function build_dfv_autocomplete_ajax_data( $options, $args, $ajax = false ) { if ( is_object( $args->pod ) ) { $pod_id = (int) $args->pod->pod_id; } else { $pod_id = 0; } $field_id = (int) $options['id']; $id = (int) $args->id; if ( is_user_logged_in() ) { $uid = 'user_' . get_current_user_id(); } else { $uid = @session_id(); } $uri_hash = wp_create_nonce( 'pods_uri_' . $_SERVER['REQUEST_URI'] ); $field_nonce = wp_create_nonce( 'pods_relationship_' . $pod_id . '_' . $uid . '_' . $uri_hash . '_' . $field_id ); // Values can be overridden via the `pods_field_dfv_data` filter in $data['fieldConfig']['ajax_data']. return array( 'ajax' => $ajax, 'delay' => 300, 'minimum_input_length' => 1, 'pod' => $pod_id, 'field' => $field_id, 'id' => $id, 'uri' => $uri_hash, '_wpnonce' => $field_nonce, ); }
[ "public", "function", "build_dfv_autocomplete_ajax_data", "(", "$", "options", ",", "$", "args", ",", "$", "ajax", "=", "false", ")", "{", "if", "(", "is_object", "(", "$", "args", "->", "pod", ")", ")", "{", "$", "pod_id", "=", "(", "int", ")", "$",...
Build DFV autocomplete AJAX data. @param array $options DFV options. @param object $args { Field information arguments. @type string $name Field name. @type string $type Field type. @type array $options Field options. @type mixed $value Current value. @type array $pod Pod information. @type int|string $id Current item ID. } @param bool $ajax True if ajax mode should be used. @return array
[ "Build", "DFV", "autocomplete", "AJAX", "data", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L880-L914
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.value_to_label
public function value_to_label( $name, $value = null, $options = null, $pod = null, $id = null ) { if ( isset( $options['options'] ) ) { $options = array_merge( $options, $options['options'] ); unset( $options['options'] ); } $data = pods_v( 'data', $options, null, true ); $object_params = array( // The name of the field. 'name' => $name, // The value of the field. 'value' => $value, // Field options. 'options' => $options, // Pod data. 'pod' => $pod, // Item ID. 'id' => $id, // Data context. 'context' => 'value_to_label', ); if ( null !== $data ) { $data = (array) $data; } else { $data = $this->get_object_data( $object_params ); } $labels = array(); $check_value = $value; foreach ( $check_value as $check_k => $check_v ) { $check_value[ $check_k ] = (string) $check_v; } foreach ( $data as $v => $l ) { if ( ! in_array( (string) $l, $labels, true ) && ( (string) $value === (string) $v || ( is_array( $value ) && in_array( (string) $v, $value, true ) ) ) ) { $labels[] = (string) $l; } } $labels = apply_filters( 'pods_field_pick_value_to_label', $labels, $name, $value, $options, $pod, $id ); $labels = pods_serial_comma( $labels ); return $labels; }
php
public function value_to_label( $name, $value = null, $options = null, $pod = null, $id = null ) { if ( isset( $options['options'] ) ) { $options = array_merge( $options, $options['options'] ); unset( $options['options'] ); } $data = pods_v( 'data', $options, null, true ); $object_params = array( // The name of the field. 'name' => $name, // The value of the field. 'value' => $value, // Field options. 'options' => $options, // Pod data. 'pod' => $pod, // Item ID. 'id' => $id, // Data context. 'context' => 'value_to_label', ); if ( null !== $data ) { $data = (array) $data; } else { $data = $this->get_object_data( $object_params ); } $labels = array(); $check_value = $value; foreach ( $check_value as $check_k => $check_v ) { $check_value[ $check_k ] = (string) $check_v; } foreach ( $data as $v => $l ) { if ( ! in_array( (string) $l, $labels, true ) && ( (string) $value === (string) $v || ( is_array( $value ) && in_array( (string) $v, $value, true ) ) ) ) { $labels[] = (string) $l; } } $labels = apply_filters( 'pods_field_pick_value_to_label', $labels, $name, $value, $options, $pod, $id ); $labels = pods_serial_comma( $labels ); return $labels; }
[ "public", "function", "value_to_label", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "options", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'optio...
Get the label from a pick value. @param string $name The name of the field. @param string|array|null $value The value of the field. @param array|null $options Field options. @param array|null $pod Pod data. @param int|null $id Item ID. @return string @since 2.2.0
[ "Get", "the", "label", "from", "a", "pick", "value", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L1791-L1842
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.get_field_data
public function get_field_data( $field, $options = array(), $object_params = array() ) { // Handle field array overrides. if ( is_array( $field ) ) { $options = array_merge( $field, $options ); } // Get field name from array. $field = pods_v( 'name', $options, $field, true ); // Field name or options not set. if ( empty( $field ) || empty( $options ) ) { return array(); } // Options normalization. $options = array_merge( $options, pods_v( 'options', $options, array(), true ) ); // Setup object params. $object_params = array_merge( array( // The name of the field. 'name' => $field, // Field options. 'options' => $options, ), $object_params ); // Get data override. $data = pods_v( 'data', $options, null, true ); if ( null !== $data ) { // Return data override. $data = (array) $data; } else { // Get object data. $data = $this->get_object_data( $object_params ); } return $data; }
php
public function get_field_data( $field, $options = array(), $object_params = array() ) { // Handle field array overrides. if ( is_array( $field ) ) { $options = array_merge( $field, $options ); } // Get field name from array. $field = pods_v( 'name', $options, $field, true ); // Field name or options not set. if ( empty( $field ) || empty( $options ) ) { return array(); } // Options normalization. $options = array_merge( $options, pods_v( 'options', $options, array(), true ) ); // Setup object params. $object_params = array_merge( array( // The name of the field. 'name' => $field, // Field options. 'options' => $options, ), $object_params ); // Get data override. $data = pods_v( 'data', $options, null, true ); if ( null !== $data ) { // Return data override. $data = (array) $data; } else { // Get object data. $data = $this->get_object_data( $object_params ); } return $data; }
[ "public", "function", "get_field_data", "(", "$", "field", ",", "$", "options", "=", "array", "(", ")", ",", "$", "object_params", "=", "array", "(", ")", ")", "{", "// Handle field array overrides.", "if", "(", "is_array", "(", "$", "field", ")", ")", "...
Get available items from a relationship field. @param array|string $field Field array or field name. @param array $options Field options array overrides. @param array $object_params Additional get_object_data options. @return array An array of available items from a relationship field
[ "Get", "available", "items", "from", "a", "relationship", "field", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L1853-L1894
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.is_autocomplete
private function is_autocomplete( $options ) { $autocomplete = false; if ( 'single' === pods_v( static::$type . '_format_type', $options, 'single' ) ) { if ( in_array( pods_v( static::$type . '_format_single', $options, 'dropdown' ), array( 'autocomplete', 'list' ), true ) ) { $autocomplete = true; } } elseif ( 'multi' === pods_v( static::$type . '_format_type', $options, 'single' ) ) { if ( in_array( pods_v( static::$type . '_format_multi', $options, 'checkbox' ), array( 'autocomplete', 'list' ), true ) ) { $autocomplete = true; } } return $autocomplete; }
php
private function is_autocomplete( $options ) { $autocomplete = false; if ( 'single' === pods_v( static::$type . '_format_type', $options, 'single' ) ) { if ( in_array( pods_v( static::$type . '_format_single', $options, 'dropdown' ), array( 'autocomplete', 'list' ), true ) ) { $autocomplete = true; } } elseif ( 'multi' === pods_v( static::$type . '_format_type', $options, 'single' ) ) { if ( in_array( pods_v( static::$type . '_format_multi', $options, 'checkbox' ), array( 'autocomplete', 'list' ), true ) ) { $autocomplete = true; } } return $autocomplete; }
[ "private", "function", "is_autocomplete", "(", "$", "options", ")", "{", "$", "autocomplete", "=", "false", ";", "if", "(", "'single'", "===", "pods_v", "(", "static", "::", "$", "type", ".", "'_format_type'", ",", "$", "options", ",", "'single'", ")", "...
Check if field is autocomplete enabled. @param array $options Field options. @return bool @since 2.7.0
[ "Check", "if", "field", "is", "autocomplete", "enabled", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L2395-L2410
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.is_simple_tableless
private function is_simple_tableless( $type, array $options ) { $field_object = pods_v( $type . '_object', $options ); return in_array( $field_object, PodsForm::simple_tableless_objects(), true ); }
php
private function is_simple_tableless( $type, array $options ) { $field_object = pods_v( $type . '_object', $options ); return in_array( $field_object, PodsForm::simple_tableless_objects(), true ); }
[ "private", "function", "is_simple_tableless", "(", "$", "type", ",", "array", "$", "options", ")", "{", "$", "field_object", "=", "pods_v", "(", "$", "type", ".", "'_object'", ",", "$", "options", ")", ";", "return", "in_array", "(", "$", "field_object", ...
Check if a field type is a tableless text field type. @since 2.7.4 @param string $type Field type. @param array $options Field options. @return bool True if the field type is a tableless text field type, false otherwise.
[ "Check", "if", "a", "field", "type", "is", "a", "tableless", "text", "field", "type", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L2421-L2425
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.can_ajax
private function can_ajax( $type, $options ) { return $this->is_autocomplete( $options ) && ! $this->is_simple_tableless( $type, $options ); }
php
private function can_ajax( $type, $options ) { return $this->is_autocomplete( $options ) && ! $this->is_simple_tableless( $type, $options ); }
[ "private", "function", "can_ajax", "(", "$", "type", ",", "$", "options", ")", "{", "return", "$", "this", "->", "is_autocomplete", "(", "$", "options", ")", "&&", "!", "$", "this", "->", "is_simple_tableless", "(", "$", "type", ",", "$", "options", ")...
Check if a field supports AJAX mode @param string $type Field type. @param array $options Field options. @return bool @since 2.7.4
[ "Check", "if", "a", "field", "supports", "AJAX", "mode" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L2436-L2438
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.data_post_stati
public function data_post_stati( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array(); $post_stati = get_post_stati( array(), 'objects' ); foreach ( $post_stati as $post_status ) { $data[ $post_status->name ] = $post_status->label; } return apply_filters( 'pods_form_ui_field_pick_data_post_stati', $data, $name, $value, $options, $pod, $id ); }
php
public function data_post_stati( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array(); $post_stati = get_post_stati( array(), 'objects' ); foreach ( $post_stati as $post_status ) { $data[ $post_status->name ] = $post_status->label; } return apply_filters( 'pods_form_ui_field_pick_data_post_stati', $data, $name, $value, $options, $pod, $id ); }
[ "public", "function", "data_post_stati", "(", "$", "name", "=", "null", ",", "$", "value", "=", "null", ",", "$", "options", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ")", "{", "$", "data", "=", "array", "(", ")", ...
Data callback for Post Stati. @param string|null $name The name of the field. @param string|array|null $value The value of the field. @param array|null $options Field options. @param array|null $pod Pod data. @param int|null $id Item ID. @return array @since 2.3.0
[ "Data", "callback", "for", "Post", "Stati", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L2580-L2592
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.data_roles
public function data_roles( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array(); global $wp_roles; foreach ( $wp_roles->role_objects as $key => $role ) { $data[ $key ] = $wp_roles->role_names[ $key ]; } return apply_filters( 'pods_form_ui_field_pick_data_roles', $data, $name, $value, $options, $pod, $id ); }
php
public function data_roles( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array(); global $wp_roles; foreach ( $wp_roles->role_objects as $key => $role ) { $data[ $key ] = $wp_roles->role_names[ $key ]; } return apply_filters( 'pods_form_ui_field_pick_data_roles', $data, $name, $value, $options, $pod, $id ); }
[ "public", "function", "data_roles", "(", "$", "name", "=", "null", ",", "$", "value", "=", "null", ",", "$", "options", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ")", "{", "$", "data", "=", "array", "(", ")", ";", ...
Data callback for User Roles. @param string|null $name The name of the field. @param string|array|null $value The value of the field. @param array|null $options Field options. @param array|null $pod Pod data. @param int|null $id Item ID. @return array @since 2.3.0
[ "Data", "callback", "for", "User", "Roles", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L2607-L2619
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.data_capabilities
public function data_capabilities( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array(); global $wp_roles; $default_caps = array( 'activate_plugins', 'add_users', 'create_users', 'delete_others_pages', 'delete_others_posts', 'delete_pages', 'delete_plugins', 'delete_posts', 'delete_private_pages', 'delete_private_posts', 'delete_published_pages', 'delete_published_posts', 'delete_users', 'edit_dashboard', 'edit_files', 'edit_others_pages', 'edit_others_posts', 'edit_pages', 'edit_plugins', 'edit_posts', 'edit_private_pages', 'edit_private_posts', 'edit_published_pages', 'edit_published_posts', 'edit_theme_options', 'edit_themes', 'edit_users', 'import', 'install_plugins', 'install_themes', 'list_users', 'manage_categories', 'manage_links', 'manage_options', 'moderate_comments', 'promote_users', 'publish_pages', 'publish_posts', 'read', 'read_private_pages', 'read_private_posts', 'remove_users', 'switch_themes', 'unfiltered_html', 'unfiltered_upload', 'update_core', 'update_plugins', 'update_themes', 'upload_files', ); $role_caps = array(); foreach ( $wp_roles->role_objects as $key => $role ) { if ( is_array( $role->capabilities ) ) { foreach ( $role->capabilities as $cap => $grant ) { $role_caps[ $cap ] = $cap; } } } $role_caps = array_unique( $role_caps ); $capabilities = array_merge( $default_caps, $role_caps ); // To support Members filters. $capabilities = apply_filters( 'members_get_capabilities', $capabilities ); $capabilities = apply_filters( 'pods_roles_get_capabilities', $capabilities ); sort( $capabilities ); $capabilities = array_unique( $capabilities ); global $wp_roles; foreach ( $capabilities as $capability ) { $data[ $capability ] = $capability; } return apply_filters( 'pods_form_ui_field_pick_data_capabilities', $data, $name, $value, $options, $pod, $id ); }
php
public function data_capabilities( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array(); global $wp_roles; $default_caps = array( 'activate_plugins', 'add_users', 'create_users', 'delete_others_pages', 'delete_others_posts', 'delete_pages', 'delete_plugins', 'delete_posts', 'delete_private_pages', 'delete_private_posts', 'delete_published_pages', 'delete_published_posts', 'delete_users', 'edit_dashboard', 'edit_files', 'edit_others_pages', 'edit_others_posts', 'edit_pages', 'edit_plugins', 'edit_posts', 'edit_private_pages', 'edit_private_posts', 'edit_published_pages', 'edit_published_posts', 'edit_theme_options', 'edit_themes', 'edit_users', 'import', 'install_plugins', 'install_themes', 'list_users', 'manage_categories', 'manage_links', 'manage_options', 'moderate_comments', 'promote_users', 'publish_pages', 'publish_posts', 'read', 'read_private_pages', 'read_private_posts', 'remove_users', 'switch_themes', 'unfiltered_html', 'unfiltered_upload', 'update_core', 'update_plugins', 'update_themes', 'upload_files', ); $role_caps = array(); foreach ( $wp_roles->role_objects as $key => $role ) { if ( is_array( $role->capabilities ) ) { foreach ( $role->capabilities as $cap => $grant ) { $role_caps[ $cap ] = $cap; } } } $role_caps = array_unique( $role_caps ); $capabilities = array_merge( $default_caps, $role_caps ); // To support Members filters. $capabilities = apply_filters( 'members_get_capabilities', $capabilities ); $capabilities = apply_filters( 'pods_roles_get_capabilities', $capabilities ); sort( $capabilities ); $capabilities = array_unique( $capabilities ); global $wp_roles; foreach ( $capabilities as $capability ) { $data[ $capability ] = $capability; } return apply_filters( 'pods_form_ui_field_pick_data_capabilities', $data, $name, $value, $options, $pod, $id ); }
[ "public", "function", "data_capabilities", "(", "$", "name", "=", "null", ",", "$", "value", "=", "null", ",", "$", "options", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ")", "{", "$", "data", "=", "array", "(", ")", ...
Data callback for User Capabilities. @param string|null $name The name of the field. @param string|array|null $value The value of the field. @param array|null $options Field options. @param array|null $pod Pod data. @param int|null $id Item ID. @return array @since 2.3.0
[ "Data", "callback", "for", "User", "Capabilities", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L2634-L2723
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.data_image_sizes
public function data_image_sizes( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array(); $image_sizes = get_intermediate_image_sizes(); foreach ( $image_sizes as $image_size ) { $data[ $image_size ] = ucwords( str_replace( '-', ' ', $image_size ) ); } return apply_filters( 'pods_form_ui_field_pick_data_image_sizes', $data, $name, $value, $options, $pod, $id ); }
php
public function data_image_sizes( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array(); $image_sizes = get_intermediate_image_sizes(); foreach ( $image_sizes as $image_size ) { $data[ $image_size ] = ucwords( str_replace( '-', ' ', $image_size ) ); } return apply_filters( 'pods_form_ui_field_pick_data_image_sizes', $data, $name, $value, $options, $pod, $id ); }
[ "public", "function", "data_image_sizes", "(", "$", "name", "=", "null", ",", "$", "value", "=", "null", ",", "$", "options", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ")", "{", "$", "data", "=", "array", "(", ")", ...
Data callback for Image Sizes. @param string|null $name The name of the field. @param string|array|null $value The value of the field. @param array|null $options Field options. @param array|null $pod Pod data. @param int|null $id Item ID. @return array @since 2.3.0
[ "Data", "callback", "for", "Image", "Sizes", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L2738-L2750
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.data_ca_provinces
public function data_ca_provinces( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array( 'AB' => __( 'Alberta' ), 'BC' => __( 'British Columbia' ), 'MB' => __( 'Manitoba' ), 'NB' => __( 'New Brunswick' ), 'NL' => __( 'Newfoundland and Labrador' ), 'NT' => __( 'Northwest Territories' ), 'NS' => __( 'Nova Scotia' ), 'NU' => __( 'Nunavut' ), 'ON' => __( 'Ontario' ), 'PE' => __( 'Prince Edward Island' ), 'QC' => __( 'Quebec' ), 'SK' => __( 'Saskatchewan' ), 'YT' => __( 'Yukon' ), ); return apply_filters( 'pods_form_ui_field_pick_data_ca_provinces', $data, $name, $value, $options, $pod, $id ); }
php
public function data_ca_provinces( $name = null, $value = null, $options = null, $pod = null, $id = null ) { $data = array( 'AB' => __( 'Alberta' ), 'BC' => __( 'British Columbia' ), 'MB' => __( 'Manitoba' ), 'NB' => __( 'New Brunswick' ), 'NL' => __( 'Newfoundland and Labrador' ), 'NT' => __( 'Northwest Territories' ), 'NS' => __( 'Nova Scotia' ), 'NU' => __( 'Nunavut' ), 'ON' => __( 'Ontario' ), 'PE' => __( 'Prince Edward Island' ), 'QC' => __( 'Quebec' ), 'SK' => __( 'Saskatchewan' ), 'YT' => __( 'Yukon' ), ); return apply_filters( 'pods_form_ui_field_pick_data_ca_provinces', $data, $name, $value, $options, $pod, $id ); }
[ "public", "function", "data_ca_provinces", "(", "$", "name", "=", "null", ",", "$", "value", "=", "null", ",", "$", "options", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ")", "{", "$", "data", "=", "array", "(", "'AB'...
Data callback for CA Provinces. @param string|null $name The name of the field. @param string|array|null $value The value of the field. @param array|null $options Field options. @param array|null $pod Pod data. @param int|null $id Item ID. @return array @since 2.3.0
[ "Data", "callback", "for", "CA", "Provinces", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L3124-L3144
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.admin_modal_bail
public function admin_modal_bail( $item_id, $item_title, $field_args ) { $model_data = $this->build_dfv_field_item_data_recurse_item( $item_id, $item_title, $field_args ); ?> <script type="text/javascript"> window.parent.jQuery( window.parent ).trigger( 'dfv:modal:update', <?php echo wp_json_encode( $model_data, JSON_HEX_TAG ); ?> ); </script> <?php die(); }
php
public function admin_modal_bail( $item_id, $item_title, $field_args ) { $model_data = $this->build_dfv_field_item_data_recurse_item( $item_id, $item_title, $field_args ); ?> <script type="text/javascript"> window.parent.jQuery( window.parent ).trigger( 'dfv:modal:update', <?php echo wp_json_encode( $model_data, JSON_HEX_TAG ); ?> ); </script> <?php die(); }
[ "public", "function", "admin_modal_bail", "(", "$", "item_id", ",", "$", "item_title", ",", "$", "field_args", ")", "{", "$", "model_data", "=", "$", "this", "->", "build_dfv_field_item_data_recurse_item", "(", "$", "item_id", ",", "$", "item_title", ",", "$",...
Bail to send new saved data back to our modal handler. @param int $item_id Item ID. @param string $item_title Item title. @param object $field_args Field arguments.
[ "Bail", "to", "send", "new", "saved", "data", "back", "to", "our", "modal", "handler", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L3214-L3228
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.admin_modal_bail_post_redirect
public function admin_modal_bail_post_redirect( $location, $post_id ) { if ( ! pods_is_modal_window() ) { return $location; } $post_title = get_the_title( $post_id ); $field_args = (object) array( 'options' => array( 'pick_object' => 'post_type', 'pick_val' => get_post_type( $post_id ), ), 'value' => array( $post_id => $post_title, ), ); $this->admin_modal_bail( $post_id, $post_title, $field_args ); return $location; }
php
public function admin_modal_bail_post_redirect( $location, $post_id ) { if ( ! pods_is_modal_window() ) { return $location; } $post_title = get_the_title( $post_id ); $field_args = (object) array( 'options' => array( 'pick_object' => 'post_type', 'pick_val' => get_post_type( $post_id ), ), 'value' => array( $post_id => $post_title, ), ); $this->admin_modal_bail( $post_id, $post_title, $field_args ); return $location; }
[ "public", "function", "admin_modal_bail_post_redirect", "(", "$", "location", ",", "$", "post_id", ")", "{", "if", "(", "!", "pods_is_modal_window", "(", ")", ")", "{", "return", "$", "location", ";", "}", "$", "post_title", "=", "get_the_title", "(", "$", ...
Bail on Post save redirect for Admin modal. @param string $location The destination URL. @param int $post_id The post ID. @return string
[ "Bail", "on", "Post", "save", "redirect", "for", "Admin", "modal", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L3253-L3275
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.admin_modal_bail_term
public function admin_modal_bail_term( $term_id, $tt_id, $taxonomy ) { if ( ! pods_is_modal_window() ) { return; } $term = get_term( $term_id ); if ( ! $term || is_wp_error( $term ) ) { return; } $field_args = (object) array( 'options' => array( 'pick_object' => 'taxonomy', 'pick_val' => $term->taxonomy, ), 'value' => array( $term->term_id => $term->name, ), ); $this->admin_modal_bail( $term->term_id, $term->name, $field_args ); }
php
public function admin_modal_bail_term( $term_id, $tt_id, $taxonomy ) { if ( ! pods_is_modal_window() ) { return; } $term = get_term( $term_id ); if ( ! $term || is_wp_error( $term ) ) { return; } $field_args = (object) array( 'options' => array( 'pick_object' => 'taxonomy', 'pick_val' => $term->taxonomy, ), 'value' => array( $term->term_id => $term->name, ), ); $this->admin_modal_bail( $term->term_id, $term->name, $field_args ); }
[ "public", "function", "admin_modal_bail_term", "(", "$", "term_id", ",", "$", "tt_id", ",", "$", "taxonomy", ")", "{", "if", "(", "!", "pods_is_modal_window", "(", ")", ")", "{", "return", ";", "}", "$", "term", "=", "get_term", "(", "$", "term_id", ")...
Bail on Term save redirect for Admin modal. @param int $term_id Term ID. @param int $tt_id Term taxonomy ID. @param string $taxonomy Taxonomy slug.
[ "Bail", "on", "Term", "save", "redirect", "for", "Admin", "modal", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L3298-L3322
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.admin_modal_bail_user_redirect
public function admin_modal_bail_user_redirect( $location ) { if ( ! pods_is_modal_window() ) { return $location; } global $user_id; $user = get_userdata( $user_id ); if ( ! $user || is_wp_error( $user ) ) { return $location; } $field_args = (object) array( 'options' => array( 'pick_object' => 'user', 'pick_val' => '', ), 'value' => array( $user->ID => $user->display_name, ), ); $this->admin_modal_bail( $user->ID, $user->display_name, $field_args ); return $location; }
php
public function admin_modal_bail_user_redirect( $location ) { if ( ! pods_is_modal_window() ) { return $location; } global $user_id; $user = get_userdata( $user_id ); if ( ! $user || is_wp_error( $user ) ) { return $location; } $field_args = (object) array( 'options' => array( 'pick_object' => 'user', 'pick_val' => '', ), 'value' => array( $user->ID => $user->display_name, ), ); $this->admin_modal_bail( $user->ID, $user->display_name, $field_args ); return $location; }
[ "public", "function", "admin_modal_bail_user_redirect", "(", "$", "location", ")", "{", "if", "(", "!", "pods_is_modal_window", "(", ")", ")", "{", "return", "$", "location", ";", "}", "global", "$", "user_id", ";", "$", "user", "=", "get_userdata", "(", "...
Bail on User save redirect for Admin modal. @param string $location The destination URL. @return string
[ "Bail", "on", "User", "save", "redirect", "for", "Admin", "modal", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L3344-L3372
train
pods-framework/pods
classes/fields/pick.php
PodsField_Pick.admin_modal_bail_pod
public function admin_modal_bail_pod( $id, $params, $obj ) { if ( ! pods_is_modal_window() ) { return; } if ( ! $obj ) { $obj = pods( $params['pod'] ); } if ( ! $obj || ! $obj->fetch( $id ) ) { return; } $item_id = $obj->id(); $item_title = $obj->index(); $field_args = (object) array( 'options' => array( 'pick_object' => $obj->pod_data['type'], 'pick_val' => $obj->pod, ), 'value' => array( $obj->id() => $item_title, ), ); $this->admin_modal_bail_JSON( $item_id, $item_title, $field_args ); }
php
public function admin_modal_bail_pod( $id, $params, $obj ) { if ( ! pods_is_modal_window() ) { return; } if ( ! $obj ) { $obj = pods( $params['pod'] ); } if ( ! $obj || ! $obj->fetch( $id ) ) { return; } $item_id = $obj->id(); $item_title = $obj->index(); $field_args = (object) array( 'options' => array( 'pick_object' => $obj->pod_data['type'], 'pick_val' => $obj->pod, ), 'value' => array( $obj->id() => $item_title, ), ); $this->admin_modal_bail_JSON( $item_id, $item_title, $field_args ); }
[ "public", "function", "admin_modal_bail_pod", "(", "$", "id", ",", "$", "params", ",", "$", "obj", ")", "{", "if", "(", "!", "pods_is_modal_window", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "$", "obj", ")", "{", "$", "obj", "=", "p...
Bail on Pod item save for Admin modal. @param int $id Item ID. @param array $params save_pod_item parameters. @param null|Pods $obj Pod object (if set).
[ "Bail", "on", "Pod", "item", "save", "for", "Admin", "modal", "." ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/pick.php#L3381-L3410
train
pods-framework/pods
classes/fields/link.php
PodsField_Link.add_link_modal
public function add_link_modal() { if ( ! class_exists( '_WP_Editors', false ) && file_exists( ABSPATH . WPINC . '/class-wp-editor.php' ) ) { require_once ABSPATH . WPINC . '/class-wp-editor.php'; } if ( class_exists( '_WP_Editors' ) && method_exists( '_WP_Editors', 'wp_link_dialog' ) ) { _WP_Editors::wp_link_dialog(); } else { echo '<div style="display:none;">'; wp_editor( '', 'pods-link-editor-hidden' ); echo '</div>'; } }
php
public function add_link_modal() { if ( ! class_exists( '_WP_Editors', false ) && file_exists( ABSPATH . WPINC . '/class-wp-editor.php' ) ) { require_once ABSPATH . WPINC . '/class-wp-editor.php'; } if ( class_exists( '_WP_Editors' ) && method_exists( '_WP_Editors', 'wp_link_dialog' ) ) { _WP_Editors::wp_link_dialog(); } else { echo '<div style="display:none;">'; wp_editor( '', 'pods-link-editor-hidden' ); echo '</div>'; } }
[ "public", "function", "add_link_modal", "(", ")", "{", "if", "(", "!", "class_exists", "(", "'_WP_Editors'", ",", "false", ")", "&&", "file_exists", "(", "ABSPATH", ".", "WPINC", ".", "'/class-wp-editor.php'", ")", ")", "{", "require_once", "ABSPATH", ".", "...
Echo the link modal code
[ "Echo", "the", "link", "modal", "code" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/link.php#L299-L313
train
pods-framework/pods
classes/PodsView.php
PodsView.get_key
public static function get_key( $key, $group_key = '' ) { // Add some salt $key .= '-' . PODS_VERSION; // Patch for limitations in DB if ( 44 < strlen( $group_key . $key ) ) { $key = md5( $key ); } return $key; }
php
public static function get_key( $key, $group_key = '' ) { // Add some salt $key .= '-' . PODS_VERSION; // Patch for limitations in DB if ( 44 < strlen( $group_key . $key ) ) { $key = md5( $key ); } return $key; }
[ "public", "static", "function", "get_key", "(", "$", "key", ",", "$", "group_key", "=", "''", ")", "{", "// Add some salt", "$", "key", ".=", "'-'", ".", "PODS_VERSION", ";", "// Patch for limitations in DB", "if", "(", "44", "<", "strlen", "(", "$", "grou...
Get the cache key, salted with current Pods version, peppered with md5 if too long @param string $key @param string $group_key @return string @since 2.6.2
[ "Get", "the", "cache", "key", "salted", "with", "current", "Pods", "version", "peppered", "with", "md5", "if", "too", "long" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsView.php#L139-L151
train
pods-framework/pods
classes/PodsForm.php
PodsForm.label
public static function label( $name, $label, $help = '', $options = null ) { if ( is_array( $label ) || is_object( $label ) ) { $options = $label; $label = $options['label']; if ( empty( $label ) ) { $label = ucwords( str_replace( '_', ' ', $name ) ); } $help = $options['help']; } else { $options = self::options( null, $options ); } $label = apply_filters( 'pods_form_ui_label_text', $label, $name, $help, $options ); $help = apply_filters( 'pods_form_ui_label_help', $help, $name, $label, $options ); ob_start(); $name_clean = self::clean( $name ); $name_more_clean = self::clean( $name, true ); $type = 'label'; $attributes = array(); $attributes['class'] = 'pods-form-ui-' . $type . ' pods-form-ui-' . $type . '-' . $name_more_clean; $attributes['for'] = ( false === strpos( $name_clean, 'pods-form-ui-' ) ? 'pods-form-ui-' : '' ) . $name_clean; $attributes = self::merge_attributes( $attributes, $name, $type, $options, false ); pods_view( PODS_DIR . 'ui/fields/_label.php', compact( array_keys( get_defined_vars() ) ) ); $output = ob_get_clean(); return apply_filters( "pods_form_ui_{$type}", $output, $name, $label, $help, $attributes, $options ); }
php
public static function label( $name, $label, $help = '', $options = null ) { if ( is_array( $label ) || is_object( $label ) ) { $options = $label; $label = $options['label']; if ( empty( $label ) ) { $label = ucwords( str_replace( '_', ' ', $name ) ); } $help = $options['help']; } else { $options = self::options( null, $options ); } $label = apply_filters( 'pods_form_ui_label_text', $label, $name, $help, $options ); $help = apply_filters( 'pods_form_ui_label_help', $help, $name, $label, $options ); ob_start(); $name_clean = self::clean( $name ); $name_more_clean = self::clean( $name, true ); $type = 'label'; $attributes = array(); $attributes['class'] = 'pods-form-ui-' . $type . ' pods-form-ui-' . $type . '-' . $name_more_clean; $attributes['for'] = ( false === strpos( $name_clean, 'pods-form-ui-' ) ? 'pods-form-ui-' : '' ) . $name_clean; $attributes = self::merge_attributes( $attributes, $name, $type, $options, false ); pods_view( PODS_DIR . 'ui/fields/_label.php', compact( array_keys( get_defined_vars() ) ) ); $output = ob_get_clean(); return apply_filters( "pods_form_ui_{$type}", $output, $name, $label, $help, $attributes, $options ); }
[ "public", "static", "function", "label", "(", "$", "name", ",", "$", "label", ",", "$", "help", "=", "''", ",", "$", "options", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "label", ")", "||", "is_object", "(", "$", "label", ")", ")", ...
Output a field's label @param string $name Field name @param string $label Label text @param string $help Help text @param array $options Field options @return string Label HTML @since 2.0.0
[ "Output", "a", "field", "s", "label" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L99-L133
train
pods-framework/pods
classes/PodsForm.php
PodsForm.comment
public static function comment( $name, $message = null, $options = null ) { $options = self::options( null, $options ); $name_more_clean = self::clean( $name, true ); if ( ! empty( $options['description'] ) ) { $message = $options['description']; } elseif ( empty( $message ) ) { return ''; } $message = apply_filters( 'pods_form_ui_comment_text', $message, $name, $options ); ob_start(); $type = 'comment'; $attributes = array(); $attributes['class'] = 'description pods-form-ui-' . $type . ' pods-form-ui-' . $type . '-' . $name_more_clean; $attributes = self::merge_attributes( $attributes, $name, $type, $options, false ); pods_view( PODS_DIR . 'ui/fields/_comment.php', compact( array_keys( get_defined_vars() ) ) ); $output = ob_get_clean(); return apply_filters( "pods_form_ui_{$type}", $output, $name, $message, $attributes, $options ); }
php
public static function comment( $name, $message = null, $options = null ) { $options = self::options( null, $options ); $name_more_clean = self::clean( $name, true ); if ( ! empty( $options['description'] ) ) { $message = $options['description']; } elseif ( empty( $message ) ) { return ''; } $message = apply_filters( 'pods_form_ui_comment_text', $message, $name, $options ); ob_start(); $type = 'comment'; $attributes = array(); $attributes['class'] = 'description pods-form-ui-' . $type . ' pods-form-ui-' . $type . '-' . $name_more_clean; $attributes = self::merge_attributes( $attributes, $name, $type, $options, false ); pods_view( PODS_DIR . 'ui/fields/_comment.php', compact( array_keys( get_defined_vars() ) ) ); $output = ob_get_clean(); return apply_filters( "pods_form_ui_{$type}", $output, $name, $message, $attributes, $options ); }
[ "public", "static", "function", "comment", "(", "$", "name", ",", "$", "message", "=", "null", ",", "$", "options", "=", "null", ")", "{", "$", "options", "=", "self", "::", "options", "(", "null", ",", "$", "options", ")", ";", "$", "name_more_clean...
Output a Field Comment Paragraph @param string $name Field name @param string $message Field comments @param array $options Field options @return string Comment HTML @since 2.0.0
[ "Output", "a", "Field", "Comment", "Paragraph" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L146-L172
train
pods-framework/pods
classes/PodsForm.php
PodsForm.field_hidden
protected static function field_hidden( $name, $value = null, $options = null ) { $form_field_type = self::$field_type; ob_start(); pods_view( PODS_DIR . 'ui/fields/_hidden.php', compact( array_keys( get_defined_vars() ) ) ); $output = ob_get_clean(); return apply_filters( 'pods_form_ui_field_hidden', $output, $name, $value, $options ); }
php
protected static function field_hidden( $name, $value = null, $options = null ) { $form_field_type = self::$field_type; ob_start(); pods_view( PODS_DIR . 'ui/fields/_hidden.php', compact( array_keys( get_defined_vars() ) ) ); $output = ob_get_clean(); return apply_filters( 'pods_form_ui_field_hidden', $output, $name, $value, $options ); }
[ "protected", "static", "function", "field_hidden", "(", "$", "name", ",", "$", "value", "=", "null", ",", "$", "options", "=", "null", ")", "{", "$", "form_field_type", "=", "self", "::", "$", "field_type", ";", "ob_start", "(", ")", ";", "pods_view", ...
Output a hidden field @param $name @param null $value @param null $options @return mixed|void
[ "Output", "a", "hidden", "field" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L329-L340
train
pods-framework/pods
classes/PodsForm.php
PodsForm.submit_button
public static function submit_button( $text = null, $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = null ) { if ( function_exists( 'get_submit_button' ) ) { return get_submit_button( $text, $type, $name, $wrap, $other_attributes ); } if ( ! is_array( $type ) ) { $type = explode( ' ', $type ); } $button_shorthand = array( 'primary', 'small', 'large', ); $classes = array( 'button', ); foreach ( $type as $t ) { if ( 'secondary' === $t || 'button-secondary' === $t ) { continue; } $classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t; } $class = implode( ' ', array_unique( $classes ) ); if ( 'delete' === $type ) { $class = 'button-secondary delete'; } $text = $text ? $text : __( 'Save Changes' ); // Default the id attribute to $name unless an id was specifically provided in $other_attributes $id = $name; if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) { $id = $other_attributes['id']; unset( $other_attributes['id'] ); } $attributes = ''; if ( is_array( $other_attributes ) ) { foreach ( $other_attributes as $attribute => $value ) { $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important } } elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string $attributes = $other_attributes; } $button = '<input type="submit" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ); $button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />'; if ( $wrap ) { $button = '<p class="submit">' . $button . '</p>'; } return $button; }
php
public static function submit_button( $text = null, $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = null ) { if ( function_exists( 'get_submit_button' ) ) { return get_submit_button( $text, $type, $name, $wrap, $other_attributes ); } if ( ! is_array( $type ) ) { $type = explode( ' ', $type ); } $button_shorthand = array( 'primary', 'small', 'large', ); $classes = array( 'button', ); foreach ( $type as $t ) { if ( 'secondary' === $t || 'button-secondary' === $t ) { continue; } $classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t; } $class = implode( ' ', array_unique( $classes ) ); if ( 'delete' === $type ) { $class = 'button-secondary delete'; } $text = $text ? $text : __( 'Save Changes' ); // Default the id attribute to $name unless an id was specifically provided in $other_attributes $id = $name; if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) { $id = $other_attributes['id']; unset( $other_attributes['id'] ); } $attributes = ''; if ( is_array( $other_attributes ) ) { foreach ( $other_attributes as $attribute => $value ) { $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important } } elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string $attributes = $other_attributes; } $button = '<input type="submit" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ); $button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />'; if ( $wrap ) { $button = '<p class="submit">' . $button . '</p>'; } return $button; }
[ "public", "static", "function", "submit_button", "(", "$", "text", "=", "null", ",", "$", "type", "=", "'primary large'", ",", "$", "name", "=", "'submit'", ",", "$", "wrap", "=", "true", ",", "$", "other_attributes", "=", "null", ")", "{", "if", "(", ...
Returns a submit button, with provided text and appropriate class, copied from WP Core for use on the frontend @see get_submit_button @param string $text The text of the button (defaults to 'Save Changes') @param string $type The type of button. One of: primary, secondary, delete @param string $name The HTML name of the submit button. Defaults to "submit". If no id attribute is given in $other_attributes below, $name will be used as the button's id. @param bool $wrap True if the output button should be wrapped in a paragraph tag, false otherwise. Defaults to true @param array|string $other_attributes Other attributes that should be output with the button, mapping attributes to their values, such as array( 'tabindex' => '1' ). These attributes will be output as attribute="value", such as tabindex="1". Defaults to no other attributes. Other attributes can also be provided as a string such as 'tabindex="1"', though the array format is typically cleaner. @since 2.7.0 @return string
[ "Returns", "a", "submit", "button", "with", "provided", "text", "and", "appropriate", "class", "copied", "from", "WP", "Core", "for", "use", "on", "the", "frontend" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L366-L431
train
pods-framework/pods
classes/PodsForm.php
PodsForm.attributes
public static function attributes( $attributes, $name = null, $type = null, $options = null ) { $attributes = (array) apply_filters( "pods_form_ui_field_{$type}_attributes", $attributes, $name, $options ); foreach ( $attributes as $attribute => $value ) { if ( null === $value ) { continue; } echo ' ' . esc_attr( (string) $attribute ) . '="' . esc_attr( (string) $value ) . '"'; } }
php
public static function attributes( $attributes, $name = null, $type = null, $options = null ) { $attributes = (array) apply_filters( "pods_form_ui_field_{$type}_attributes", $attributes, $name, $options ); foreach ( $attributes as $attribute => $value ) { if ( null === $value ) { continue; } echo ' ' . esc_attr( (string) $attribute ) . '="' . esc_attr( (string) $value ) . '"'; } }
[ "public", "static", "function", "attributes", "(", "$", "attributes", ",", "$", "name", "=", "null", ",", "$", "type", "=", "null", ",", "$", "options", "=", "null", ")", "{", "$", "attributes", "=", "(", "array", ")", "apply_filters", "(", "\"pods_for...
Output a field's attributes @since 2.0.0 @param $attributes @param null $name @param null $type @param null $options
[ "Output", "a", "field", "s", "attributes" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L470-L481
train
pods-framework/pods
classes/PodsForm.php
PodsForm.options
public static function options( $type, $options ) { $options = (array) $options; if ( ! is_object( $options ) && isset( $options['options'] ) ) { $options_temp = $options['options']; unset( $options['options'] ); $options = array_merge( $options_temp, $options ); $override = array( 'class', ); foreach ( $override as $check ) { if ( isset( $options_temp[ $check ] ) ) { $options[ $check ] = $options_temp[ $check ]; } } } $defaults = self::options_setup( $type, $options ); $core_defaults = array( 'id' => 0, 'label' => '', 'description' => '', 'help' => '', 'default' => null, 'attributes' => array(), 'class' => '', 'grouped' => 0, ); $defaults = array_merge( $core_defaults, $defaults ); foreach ( $defaults as $option => $settings ) { $default = $settings; if ( is_array( $settings ) && isset( $settings['default'] ) ) { $default = $settings['default']; } if ( ! isset( $options[ $option ] ) ) { $options[ $option ] = $default; } } return $options; }
php
public static function options( $type, $options ) { $options = (array) $options; if ( ! is_object( $options ) && isset( $options['options'] ) ) { $options_temp = $options['options']; unset( $options['options'] ); $options = array_merge( $options_temp, $options ); $override = array( 'class', ); foreach ( $override as $check ) { if ( isset( $options_temp[ $check ] ) ) { $options[ $check ] = $options_temp[ $check ]; } } } $defaults = self::options_setup( $type, $options ); $core_defaults = array( 'id' => 0, 'label' => '', 'description' => '', 'help' => '', 'default' => null, 'attributes' => array(), 'class' => '', 'grouped' => 0, ); $defaults = array_merge( $core_defaults, $defaults ); foreach ( $defaults as $option => $settings ) { $default = $settings; if ( is_array( $settings ) && isset( $settings['default'] ) ) { $default = $settings['default']; } if ( ! isset( $options[ $option ] ) ) { $options[ $option ] = $default; } } return $options; }
[ "public", "static", "function", "options", "(", "$", "type", ",", "$", "options", ")", "{", "$", "options", "=", "(", "array", ")", "$", "options", ";", "if", "(", "!", "is_object", "(", "$", "options", ")", "&&", "isset", "(", "$", "options", "[",...
Setup options for a field and store them for later use @param $type @param $options @return array @static @since 2.0.0
[ "Setup", "options", "for", "a", "field", "and", "store", "them", "for", "later", "use" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L612-L662
train
pods-framework/pods
classes/PodsForm.php
PodsForm.options_setup
public static function options_setup( $type = null, $options = null ) { $core_defaults = array( 'id' => 0, 'name' => '', 'label' => '', 'description' => '', 'help' => '', 'default' => null, 'attributes' => array(), 'class' => '', 'type' => 'text', 'group' => 0, 'grouped' => 0, 'developer_mode' => false, 'dependency' => false, 'depends-on' => array(), 'excludes-on' => array(), 'options' => array(), ); if ( ! empty( $options ) && is_array( $options ) ) { $core_defaults = array_merge( $core_defaults, $options ); } if ( null === $type ) { return $core_defaults; } else { self::field_loader( $type ); } $options = apply_filters( "pods_field_{$type}_options", (array) self::$loaded[ $type ]->options(), $type ); $first_field = current( $options ); if ( ! empty( $options ) && ! isset( $first_field['name'] ) && ! isset( $first_field['label'] ) ) { $all_options = array(); foreach ( $options as $group => $group_options ) { $all_options = array_merge( $all_options, self::fields_setup( $group_options, $core_defaults ) ); } $options = $all_options; } else { $options = self::fields_setup( $options, $core_defaults ); } return $options; }
php
public static function options_setup( $type = null, $options = null ) { $core_defaults = array( 'id' => 0, 'name' => '', 'label' => '', 'description' => '', 'help' => '', 'default' => null, 'attributes' => array(), 'class' => '', 'type' => 'text', 'group' => 0, 'grouped' => 0, 'developer_mode' => false, 'dependency' => false, 'depends-on' => array(), 'excludes-on' => array(), 'options' => array(), ); if ( ! empty( $options ) && is_array( $options ) ) { $core_defaults = array_merge( $core_defaults, $options ); } if ( null === $type ) { return $core_defaults; } else { self::field_loader( $type ); } $options = apply_filters( "pods_field_{$type}_options", (array) self::$loaded[ $type ]->options(), $type ); $first_field = current( $options ); if ( ! empty( $options ) && ! isset( $first_field['name'] ) && ! isset( $first_field['label'] ) ) { $all_options = array(); foreach ( $options as $group => $group_options ) { $all_options = array_merge( $all_options, self::fields_setup( $group_options, $core_defaults ) ); } $options = $all_options; } else { $options = self::fields_setup( $options, $core_defaults ); } return $options; }
[ "public", "static", "function", "options_setup", "(", "$", "type", "=", "null", ",", "$", "options", "=", "null", ")", "{", "$", "core_defaults", "=", "array", "(", "'id'", "=>", "0", ",", "'name'", "=>", "''", ",", "'label'", "=>", "''", ",", "'desc...
Get options for a field type and setup defaults @static @param $type @param null $options @return array|null @since 2.0.0
[ "Get", "options", "for", "a", "field", "type", "and", "setup", "defaults" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L676-L724
train
pods-framework/pods
classes/PodsForm.php
PodsForm.ui_options
public static function ui_options( $type ) { $core_defaults = array( 'id' => 0, 'name' => '', 'label' => '', 'description' => '', 'help' => '', 'default' => null, 'attributes' => array(), 'class' => '', 'type' => 'text', 'group' => 0, 'grouped' => 0, 'developer_mode' => false, 'dependency' => false, 'depends-on' => array(), 'excludes-on' => array(), 'options' => array(), ); self::field_loader( $type ); $options = apply_filters( "pods_field_{$type}_ui_options", (array) self::$loaded[ $type ]->ui_options(), $type ); $first_field = current( $options ); if ( ! empty( $options ) && ! isset( $first_field['name'] ) && ! isset( $first_field['label'] ) ) { foreach ( $options as $group => $group_options ) { $options[ $group ] = self::fields_setup( $group_options, $core_defaults ); } } else { $options = self::fields_setup( $options, $core_defaults ); } return $options; }
php
public static function ui_options( $type ) { $core_defaults = array( 'id' => 0, 'name' => '', 'label' => '', 'description' => '', 'help' => '', 'default' => null, 'attributes' => array(), 'class' => '', 'type' => 'text', 'group' => 0, 'grouped' => 0, 'developer_mode' => false, 'dependency' => false, 'depends-on' => array(), 'excludes-on' => array(), 'options' => array(), ); self::field_loader( $type ); $options = apply_filters( "pods_field_{$type}_ui_options", (array) self::$loaded[ $type ]->ui_options(), $type ); $first_field = current( $options ); if ( ! empty( $options ) && ! isset( $first_field['name'] ) && ! isset( $first_field['label'] ) ) { foreach ( $options as $group => $group_options ) { $options[ $group ] = self::fields_setup( $group_options, $core_defaults ); } } else { $options = self::fields_setup( $options, $core_defaults ); } return $options; }
[ "public", "static", "function", "ui_options", "(", "$", "type", ")", "{", "$", "core_defaults", "=", "array", "(", "'id'", "=>", "0", ",", "'name'", "=>", "''", ",", "'label'", "=>", "''", ",", "'description'", "=>", "''", ",", "'help'", "=>", "''", ...
Get Admin options for a field type and setup defaults @static @param $type @return array|null @since 2.0.0
[ "Get", "Admin", "options", "for", "a", "field", "type", "and", "setup", "defaults" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L737-L773
train
pods-framework/pods
classes/PodsForm.php
PodsForm.value
public static function value( $type, $value = null, $name = null, $options = null, $pod = null, $id = null, $traverse = null ) { self::field_loader( $type ); if ( in_array( $type, self::repeatable_field_types() ) && 1 == pods_v( $type . '_repeatable', $options, 0 ) && ! is_array( $value ) ) { if ( 0 < strlen( $value ) ) { $simple = @json_decode( $value, true ); if ( is_array( $simple ) ) { $value = $simple; } else { $value = (array) $value; } } else { $value = array(); } } if ( is_array( $value ) && in_array( $type, self::tableless_field_types(), true ) ) { foreach ( $value as &$display_value ) { $display_value = call_user_func( array( self::$loaded[ $type ], 'value', ), $display_value, $name, $options, $pod, $id, $traverse ); } } else { $value = call_user_func( array( self::$loaded[ $type ], 'value', ), $value, $name, $options, $pod, $id, $traverse ); }//end if return $value; }
php
public static function value( $type, $value = null, $name = null, $options = null, $pod = null, $id = null, $traverse = null ) { self::field_loader( $type ); if ( in_array( $type, self::repeatable_field_types() ) && 1 == pods_v( $type . '_repeatable', $options, 0 ) && ! is_array( $value ) ) { if ( 0 < strlen( $value ) ) { $simple = @json_decode( $value, true ); if ( is_array( $simple ) ) { $value = $simple; } else { $value = (array) $value; } } else { $value = array(); } } if ( is_array( $value ) && in_array( $type, self::tableless_field_types(), true ) ) { foreach ( $value as &$display_value ) { $display_value = call_user_func( array( self::$loaded[ $type ], 'value', ), $display_value, $name, $options, $pod, $id, $traverse ); } } else { $value = call_user_func( array( self::$loaded[ $type ], 'value', ), $value, $name, $options, $pod, $id, $traverse ); }//end if return $value; }
[ "public", "static", "function", "value", "(", "$", "type", ",", "$", "value", "=", "null", ",", "$", "name", "=", "null", ",", "$", "options", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ",", "$", "traverse", "=", "n...
Change the value of the field @param $type @param mixed $value @param string $name @param array $options @param array $pod @param int $id @param array $traverse @return array|mixed|null|object @internal param array $fields @since 2.3.0
[ "Change", "the", "value", "of", "the", "field" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1001-L1034
train
pods-framework/pods
classes/PodsForm.php
PodsForm.prepare
public static function prepare( $type, $options ) { self::field_loader( $type ); $prepare = '%s'; if ( method_exists( self::$loaded[ $type ], 'prepare' ) ) { $prepare = self::$loaded[ $type ]->prepare( $options ); } $prepare = apply_filters( "pods_field_{$type}_prepare", $prepare, $options, $type ); return $prepare; }
php
public static function prepare( $type, $options ) { self::field_loader( $type ); $prepare = '%s'; if ( method_exists( self::$loaded[ $type ], 'prepare' ) ) { $prepare = self::$loaded[ $type ]->prepare( $options ); } $prepare = apply_filters( "pods_field_{$type}_prepare", $prepare, $options, $type ); return $prepare; }
[ "public", "static", "function", "prepare", "(", "$", "type", ",", "$", "options", ")", "{", "self", "::", "field_loader", "(", "$", "type", ")", ";", "$", "prepare", "=", "'%s'", ";", "if", "(", "method_exists", "(", "self", "::", "$", "loaded", "[",...
Setup value preparation for sprintf @static @param $type @param $options @return mixed|void @since 2.0.0
[ "Setup", "value", "preparation", "for", "sprintf" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1138-L1151
train
pods-framework/pods
classes/PodsForm.php
PodsForm.validate
public static function validate( $type, $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { self::field_loader( $type ); $validate = true; if ( 1 == pods_v( 'pre_save', $options, 1 ) && method_exists( self::$loaded[ $type ], 'validate' ) ) { $validate = self::$loaded[ $type ]->validate( $value, $name, $options, $fields, $pod, $id, $params ); } $validate = apply_filters( "pods_field_{$type}_validate", $validate, $value, $name, $options, $fields, $pod, $id, $type, $params ); return $validate; }
php
public static function validate( $type, $value, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { self::field_loader( $type ); $validate = true; if ( 1 == pods_v( 'pre_save', $options, 1 ) && method_exists( self::$loaded[ $type ], 'validate' ) ) { $validate = self::$loaded[ $type ]->validate( $value, $name, $options, $fields, $pod, $id, $params ); } $validate = apply_filters( "pods_field_{$type}_validate", $validate, $value, $name, $options, $fields, $pod, $id, $type, $params ); return $validate; }
[ "public", "static", "function", "validate", "(", "$", "type", ",", "$", "value", ",", "$", "name", "=", "null", ",", "$", "options", "=", "null", ",", "$", "fields", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ",", "...
Validate a value before it's saved @param string $type @param mixed $value @param string $name @param array $options @param array $fields @param array $pod @param int $id @param array|object $params @static @since 2.0.0 @return bool|mixed|void
[ "Validate", "a", "value", "before", "it", "s", "saved" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1170-L1183
train
pods-framework/pods
classes/PodsForm.php
PodsForm.pre_save
public static function pre_save( $type, $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) { self::field_loader( $type ); if ( 1 == pods_v( 'field_pre_save', $options, 1 ) && method_exists( self::$loaded[ $type ], 'pre_save' ) ) { $value = self::$loaded[ $type ]->pre_save( $value, $id, $name, $options, $fields, $pod, $params ); } return $value; }
php
public static function pre_save( $type, $value, $id = null, $name = null, $options = null, $fields = null, $pod = null, $params = null ) { self::field_loader( $type ); if ( 1 == pods_v( 'field_pre_save', $options, 1 ) && method_exists( self::$loaded[ $type ], 'pre_save' ) ) { $value = self::$loaded[ $type ]->pre_save( $value, $id, $name, $options, $fields, $pod, $params ); } return $value; }
[ "public", "static", "function", "pre_save", "(", "$", "type", ",", "$", "value", ",", "$", "id", "=", "null", ",", "$", "name", "=", "null", ",", "$", "options", "=", "null", ",", "$", "fields", "=", "null", ",", "$", "pod", "=", "null", ",", "...
Change the value or perform actions after validation but before saving to the DB @param string $type @param mixed $value @param int $id @param string $name @param array $options @param array $fields @param array $pod @param object $params @static @since 2.0.0 @return mixed
[ "Change", "the", "value", "or", "perform", "actions", "after", "validation", "but", "before", "saving", "to", "the", "DB" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1202-L1211
train
pods-framework/pods
classes/PodsForm.php
PodsForm.permission
public static function permission( $type, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { $permission = pods_permission( $options ); $permission = (boolean) apply_filters( 'pods_form_field_permission', $permission, $type, $name, $options, $fields, $pod, $id, $params ); return $permission; }
php
public static function permission( $type, $name = null, $options = null, $fields = null, $pod = null, $id = null, $params = null ) { $permission = pods_permission( $options ); $permission = (boolean) apply_filters( 'pods_form_field_permission', $permission, $type, $name, $options, $fields, $pod, $id, $params ); return $permission; }
[ "public", "static", "function", "permission", "(", "$", "type", ",", "$", "name", "=", "null", ",", "$", "options", "=", "null", ",", "$", "fields", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ",", "$", "params", "=", ...
Check if a user has permission to be editing a field @param $type @param null $name @param null $options @param null $fields @param null $pod @param null $id @param null $params @static @since 2.0.0 @return bool
[ "Check", "if", "a", "user", "has", "permission", "to", "be", "editing", "a", "field" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1286-L1293
train
pods-framework/pods
classes/PodsForm.php
PodsForm.default_value
public static function default_value( $value, $type = 'text', $name = null, $options = null, $pod = null, $id = null ) { $default_value = pods_v( 'default_value', $options ); if ( '' === $default_value || null === $default_value ) { $default_value = $value; } $default = pods_v( 'default', $options, $default_value, true ); if ( is_string( $default ) ) { $default_value = str_replace( array( '{@', '}' ), '', trim( $default ) ); } if ( $default != $default_value && 1 == (int) pods_v( 'default_evaluate_tags', $options, 1 ) ) { $default = pods_evaluate_tags( $default ); } $default = pods_v( pods_v( 'default_value_parameter', $options ), 'request', $default, true ); if ( $default != $value ) { $value = $default; } if ( is_array( $value ) ) { $value = pods_serial_comma( $value ); } return apply_filters( 'pods_form_field_default_value', $value, $default, $type, $options, $pod, $id ); }
php
public static function default_value( $value, $type = 'text', $name = null, $options = null, $pod = null, $id = null ) { $default_value = pods_v( 'default_value', $options ); if ( '' === $default_value || null === $default_value ) { $default_value = $value; } $default = pods_v( 'default', $options, $default_value, true ); if ( is_string( $default ) ) { $default_value = str_replace( array( '{@', '}' ), '', trim( $default ) ); } if ( $default != $default_value && 1 == (int) pods_v( 'default_evaluate_tags', $options, 1 ) ) { $default = pods_evaluate_tags( $default ); } $default = pods_v( pods_v( 'default_value_parameter', $options ), 'request', $default, true ); if ( $default != $value ) { $value = $default; } if ( is_array( $value ) ) { $value = pods_serial_comma( $value ); } return apply_filters( 'pods_form_field_default_value', $value, $default, $type, $options, $pod, $id ); }
[ "public", "static", "function", "default_value", "(", "$", "value", ",", "$", "type", "=", "'text'", ",", "$", "name", "=", "null", ",", "$", "options", "=", "null", ",", "$", "pod", "=", "null", ",", "$", "id", "=", "null", ")", "{", "$", "defau...
Parse the default the value @since 2.0.0 @param $value @param string $type @param null $name @param null $options @param null $pod @param null $id @return mixed|void
[ "Parse", "the", "default", "the", "value" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1309-L1338
train
pods-framework/pods
classes/PodsForm.php
PodsForm.admin_init
public function admin_init() { $admin_field_types = pods_transient_get( 'pods_form_admin_init_field_types' ); if ( empty( $admin_field_types ) ) { $admin_field_types = array(); $field_types = self::field_types(); foreach ( $field_types as $field_type => $field_type_data ) { $has_admin_init = self::field_method( $field_type_data['type'], 'admin_init' ); if ( false !== $has_admin_init ) { $admin_field_types[] = $field_type; } } pods_transient_set( 'pods_form_admin_init_field_types', $admin_field_types ); } else { foreach ( $admin_field_types as $field_type ) { self::field_method( $field_type, 'admin_init' ); } } }
php
public function admin_init() { $admin_field_types = pods_transient_get( 'pods_form_admin_init_field_types' ); if ( empty( $admin_field_types ) ) { $admin_field_types = array(); $field_types = self::field_types(); foreach ( $field_types as $field_type => $field_type_data ) { $has_admin_init = self::field_method( $field_type_data['type'], 'admin_init' ); if ( false !== $has_admin_init ) { $admin_field_types[] = $field_type; } } pods_transient_set( 'pods_form_admin_init_field_types', $admin_field_types ); } else { foreach ( $admin_field_types as $field_type ) { self::field_method( $field_type, 'admin_init' ); } } }
[ "public", "function", "admin_init", "(", ")", "{", "$", "admin_field_types", "=", "pods_transient_get", "(", "'pods_form_admin_init_field_types'", ")", ";", "if", "(", "empty", "(", "$", "admin_field_types", ")", ")", "{", "$", "admin_field_types", "=", "array", ...
Run admin_init methods for each field type @since 2.3.0
[ "Run", "admin_init", "methods", "for", "each", "field", "type" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1388-L1411
train
pods-framework/pods
classes/PodsForm.php
PodsForm.field_loader
public static function field_loader( $field_type, $file = '' ) { if ( isset( self::$loaded[ $field_type ] ) ) { $class_vars = get_class_vars( get_class( self::$loaded[ $field_type ] ) ); // PHP 5.2.x workaround self::$field_group = ( isset( $class_vars['group'] ) ? $class_vars['group'] : '' ); self::$field_type = $class_vars['type']; if ( 'Unknown' !== $class_vars['label'] ) { return self::$loaded[ $field_type ]; } } include_once PODS_DIR . 'classes/PodsField.php'; $field_type = self::clean( $field_type, true, true ); $class_name = ucfirst( $field_type ); $class_name = "PodsField_{$class_name}"; $content_dir = realpath( WP_CONTENT_DIR ); $plugins_dir = realpath( WP_PLUGIN_DIR ); $muplugins_dir = realpath( WPMU_PLUGIN_DIR ); $abspath_dir = realpath( ABSPATH ); $pods_dir = realpath( PODS_DIR ); if ( ! class_exists( $class_name ) ) { if ( isset( self::$field_types[ $field_type ] ) && ! empty( self::$field_types[ $field_type ]['file'] ) ) { $file = realpath( self::$field_types[ $field_type ]['file'] ); } if ( ! empty( $file ) && 0 === strpos( $file, $abspath_dir ) && file_exists( $file ) ) { include_once $file; } else { $file = str_replace( '../', '', apply_filters( 'pods_form_field_include', PODS_DIR . 'classes/fields/' . basename( $field_type ) . '.php', $field_type ) ); $file = realpath( $file ); if ( file_exists( $file ) && ( 0 === strpos( $file, $pods_dir ) || 0 === strpos( $file, $content_dir ) || 0 === strpos( $file, $plugins_dir ) || 0 === strpos( $file, $muplugins_dir ) || 0 === strpos( $file, $abspath_dir ) ) ) { include_once $file; } } } if ( class_exists( $class_name ) ) { $class = new $class_name(); } else { $class = new PodsField(); $class_name = 'PodsField'; } $class_vars = get_class_vars( $class_name ); // PHP 5.2.x workaround self::$field_group = ( isset( $class_vars['group'] ) ? $class_vars['group'] : '' ); self::$field_type = $class_vars['type']; self::$loaded[ $field_type ] =& $class; return self::$loaded[ $field_type ]; }
php
public static function field_loader( $field_type, $file = '' ) { if ( isset( self::$loaded[ $field_type ] ) ) { $class_vars = get_class_vars( get_class( self::$loaded[ $field_type ] ) ); // PHP 5.2.x workaround self::$field_group = ( isset( $class_vars['group'] ) ? $class_vars['group'] : '' ); self::$field_type = $class_vars['type']; if ( 'Unknown' !== $class_vars['label'] ) { return self::$loaded[ $field_type ]; } } include_once PODS_DIR . 'classes/PodsField.php'; $field_type = self::clean( $field_type, true, true ); $class_name = ucfirst( $field_type ); $class_name = "PodsField_{$class_name}"; $content_dir = realpath( WP_CONTENT_DIR ); $plugins_dir = realpath( WP_PLUGIN_DIR ); $muplugins_dir = realpath( WPMU_PLUGIN_DIR ); $abspath_dir = realpath( ABSPATH ); $pods_dir = realpath( PODS_DIR ); if ( ! class_exists( $class_name ) ) { if ( isset( self::$field_types[ $field_type ] ) && ! empty( self::$field_types[ $field_type ]['file'] ) ) { $file = realpath( self::$field_types[ $field_type ]['file'] ); } if ( ! empty( $file ) && 0 === strpos( $file, $abspath_dir ) && file_exists( $file ) ) { include_once $file; } else { $file = str_replace( '../', '', apply_filters( 'pods_form_field_include', PODS_DIR . 'classes/fields/' . basename( $field_type ) . '.php', $field_type ) ); $file = realpath( $file ); if ( file_exists( $file ) && ( 0 === strpos( $file, $pods_dir ) || 0 === strpos( $file, $content_dir ) || 0 === strpos( $file, $plugins_dir ) || 0 === strpos( $file, $muplugins_dir ) || 0 === strpos( $file, $abspath_dir ) ) ) { include_once $file; } } } if ( class_exists( $class_name ) ) { $class = new $class_name(); } else { $class = new PodsField(); $class_name = 'PodsField'; } $class_vars = get_class_vars( $class_name ); // PHP 5.2.x workaround self::$field_group = ( isset( $class_vars['group'] ) ? $class_vars['group'] : '' ); self::$field_type = $class_vars['type']; self::$loaded[ $field_type ] =& $class; return self::$loaded[ $field_type ]; }
[ "public", "static", "function", "field_loader", "(", "$", "field_type", ",", "$", "file", "=", "''", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "loaded", "[", "$", "field_type", "]", ")", ")", "{", "$", "class_vars", "=", "get_class_vars", ...
Autoload a Field Type's class @param string $field_type Field Type indentifier @param string $file The Field Type class file location @return string @access public @static @since 2.0.0
[ "Autoload", "a", "Field", "Type", "s", "class" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1424-L1482
train
pods-framework/pods
classes/PodsForm.php
PodsForm.field_method
public static function field_method() { $args = func_get_args(); if ( empty( $args ) && count( $args ) < 2 ) { return false; } $field_type = array_shift( $args ); $method = array_shift( $args ); $class = self::field_loader( $field_type ); if ( method_exists( $class, $method ) ) { return call_user_func_array( array( $class, $method ), $args ); } return false; }
php
public static function field_method() { $args = func_get_args(); if ( empty( $args ) && count( $args ) < 2 ) { return false; } $field_type = array_shift( $args ); $method = array_shift( $args ); $class = self::field_loader( $field_type ); if ( method_exists( $class, $method ) ) { return call_user_func_array( array( $class, $method ), $args ); } return false; }
[ "public", "static", "function", "field_method", "(", ")", "{", "$", "args", "=", "func_get_args", "(", ")", ";", "if", "(", "empty", "(", "$", "args", ")", "&&", "count", "(", "$", "args", ")", "<", "2", ")", "{", "return", "false", ";", "}", "$"...
Run a method from a Field Type's class @return mixed @internal param string $field_type Field Type indentifier @internal param string $method Method name @internal param mixed $arg More arguments @access public @static @since 2.0.0
[ "Run", "a", "method", "from", "a", "Field", "Type", "s", "class" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1496-L1514
train
pods-framework/pods
classes/PodsForm.php
PodsForm.register_field_type
public static function register_field_type( $type, $file = null ) { $field_type = pods_transient_get( 'pods_field_type_' . $type ); if ( empty( $field_type ) || $field_type['type'] != $type || $field_type['file'] != $file ) { self::field_loader( $type, $file ); $class_vars = get_class_vars( get_class( self::$loaded[ $type ] ) ); // PHP 5.2.x workaround self::$field_types[ $type ] = $class_vars; self::$field_types[ $type ]['file'] = $file; pods_transient_set( 'pods_field_type_' . $type, self::$field_types[ $type ] ); } else { self::$field_types[ $type ] = $field_type; } return self::$field_types[ $type ]; }
php
public static function register_field_type( $type, $file = null ) { $field_type = pods_transient_get( 'pods_field_type_' . $type ); if ( empty( $field_type ) || $field_type['type'] != $type || $field_type['file'] != $file ) { self::field_loader( $type, $file ); $class_vars = get_class_vars( get_class( self::$loaded[ $type ] ) ); // PHP 5.2.x workaround self::$field_types[ $type ] = $class_vars; self::$field_types[ $type ]['file'] = $file; pods_transient_set( 'pods_field_type_' . $type, self::$field_types[ $type ] ); } else { self::$field_types[ $type ] = $field_type; } return self::$field_types[ $type ]; }
[ "public", "static", "function", "register_field_type", "(", "$", "type", ",", "$", "file", "=", "null", ")", "{", "$", "field_type", "=", "pods_transient_get", "(", "'pods_field_type_'", ".", "$", "type", ")", ";", "if", "(", "empty", "(", "$", "field_type...
Add a new Pod field type @param string $type The new field type identifier @param string $file The new field type class file location @return array Field Type data @since 2.3.0
[ "Add", "a", "new", "Pod", "field", "type" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1526-L1544
train
pods-framework/pods
classes/PodsForm.php
PodsForm.field_types
public static function field_types() { $field_types = array( 'text', 'website', // 'link', 'phone', 'email', 'password', 'paragraph', 'wysiwyg', 'code', 'datetime', 'date', 'time', 'number', 'currency', 'file', 'avatar', 'oembed', 'pick', 'boolean', 'color', 'slug', ); $field_types = array_merge( $field_types, array_keys( self::$field_types ) ); $field_types = array_filter( array_unique( $field_types ) ); $types = apply_filters( 'pods_api_field_types', $field_types ); $field_types = pods_transient_get( 'pods_field_types' ); if ( empty( $field_types ) || count( $types ) != count( $field_types ) ) { $field_types = array(); foreach ( $types as $field_type ) { $file = null; if ( isset( self::$field_types[ $field_type ] ) ) { $file = self::$field_types[ $field_type ]['file']; } self::field_loader( $field_type, $file ); if ( ! isset( self::$loaded[ $field_type ] ) || ! is_object( self::$loaded[ $field_type ] ) ) { continue; } $class_vars = get_class_vars( get_class( self::$loaded[ $field_type ] ) ); // PHP 5.2.x workaround $field_types[ $field_type ] = $class_vars; $field_types[ $field_type ]['file'] = $file; } self::$field_types = $field_types; pods_transient_set( 'pods_field_types', self::$field_types ); } else { self::$field_types = array_merge( $field_types, self::$field_types ); }//end if return self::$field_types; }
php
public static function field_types() { $field_types = array( 'text', 'website', // 'link', 'phone', 'email', 'password', 'paragraph', 'wysiwyg', 'code', 'datetime', 'date', 'time', 'number', 'currency', 'file', 'avatar', 'oembed', 'pick', 'boolean', 'color', 'slug', ); $field_types = array_merge( $field_types, array_keys( self::$field_types ) ); $field_types = array_filter( array_unique( $field_types ) ); $types = apply_filters( 'pods_api_field_types', $field_types ); $field_types = pods_transient_get( 'pods_field_types' ); if ( empty( $field_types ) || count( $types ) != count( $field_types ) ) { $field_types = array(); foreach ( $types as $field_type ) { $file = null; if ( isset( self::$field_types[ $field_type ] ) ) { $file = self::$field_types[ $field_type ]['file']; } self::field_loader( $field_type, $file ); if ( ! isset( self::$loaded[ $field_type ] ) || ! is_object( self::$loaded[ $field_type ] ) ) { continue; } $class_vars = get_class_vars( get_class( self::$loaded[ $field_type ] ) ); // PHP 5.2.x workaround $field_types[ $field_type ] = $class_vars; $field_types[ $field_type ]['file'] = $file; } self::$field_types = $field_types; pods_transient_set( 'pods_field_types', self::$field_types ); } else { self::$field_types = array_merge( $field_types, self::$field_types ); }//end if return self::$field_types; }
[ "public", "static", "function", "field_types", "(", ")", "{", "$", "field_types", "=", "array", "(", "'text'", ",", "'website'", ",", "// 'link',", "'phone'", ",", "'email'", ",", "'password'", ",", "'paragraph'", ",", "'wysiwyg'", ",", "'code'", ",", "'date...
Get a list of all available field types and include @return array Registered Field Types data @since 2.3.0
[ "Get", "a", "list", "of", "all", "available", "field", "types", "and", "include" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1553-L1617
train
pods-framework/pods
classes/PodsForm.php
PodsForm.tableless_field_types
public static function tableless_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'pick', 'file', 'avatar', 'taxonomy', 'comment', ); $field_types = apply_filters( 'pods_tableless_field_types', $field_types ); } return $field_types; }
php
public static function tableless_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'pick', 'file', 'avatar', 'taxonomy', 'comment', ); $field_types = apply_filters( 'pods_tableless_field_types', $field_types ); } return $field_types; }
[ "public", "static", "function", "tableless_field_types", "(", ")", "{", "static", "$", "field_types", "=", "null", ";", "if", "(", "null", "===", "$", "field_types", ")", "{", "$", "field_types", "=", "array", "(", "'pick'", ",", "'file'", ",", "'avatar'",...
Get list of available tableless field types @return array Tableless field types @since 2.3.0
[ "Get", "list", "of", "available", "tableless", "field", "types" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1626-L1643
train
pods-framework/pods
classes/PodsForm.php
PodsForm.file_field_types
public static function file_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'file', 'avatar' ); $field_types = apply_filters( 'pods_file_field_types', $field_types ); } return $field_types; }
php
public static function file_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'file', 'avatar' ); $field_types = apply_filters( 'pods_file_field_types', $field_types ); } return $field_types; }
[ "public", "static", "function", "file_field_types", "(", ")", "{", "static", "$", "field_types", "=", "null", ";", "if", "(", "null", "===", "$", "field_types", ")", "{", "$", "field_types", "=", "array", "(", "'file'", ",", "'avatar'", ")", ";", "$", ...
Get list of available file field types @return array File field types @since 2.3.0
[ "Get", "list", "of", "available", "file", "field", "types" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1652-L1663
train
pods-framework/pods
classes/PodsForm.php
PodsForm.repeatable_field_types
public static function repeatable_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'code', 'color', 'currency', 'date', 'datetime', 'email', 'number', 'paragraph', 'phone', 'text', 'time', 'website', 'wysiwyg', ); $field_types = apply_filters( 'pods_repeatable_field_types', $field_types ); } return $field_types; }
php
public static function repeatable_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'code', 'color', 'currency', 'date', 'datetime', 'email', 'number', 'paragraph', 'phone', 'text', 'time', 'website', 'wysiwyg', ); $field_types = apply_filters( 'pods_repeatable_field_types', $field_types ); } return $field_types; }
[ "public", "static", "function", "repeatable_field_types", "(", ")", "{", "static", "$", "field_types", "=", "null", ";", "if", "(", "null", "===", "$", "field_types", ")", "{", "$", "field_types", "=", "array", "(", "'code'", ",", "'color'", ",", "'currenc...
Get list of available repeatable field types @return array Repeatable field types @since 2.3.0
[ "Get", "list", "of", "available", "repeatable", "field", "types" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1672-L1697
train
pods-framework/pods
classes/PodsForm.php
PodsForm.number_field_types
public static function number_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'currency', 'number' ); $field_types = apply_filters( 'pods_tableless_field_types', $field_types ); } return $field_types; }
php
public static function number_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'currency', 'number' ); $field_types = apply_filters( 'pods_tableless_field_types', $field_types ); } return $field_types; }
[ "public", "static", "function", "number_field_types", "(", ")", "{", "static", "$", "field_types", "=", "null", ";", "if", "(", "null", "===", "$", "field_types", ")", "{", "$", "field_types", "=", "array", "(", "'currency'", ",", "'number'", ")", ";", "...
Get list of available number field types @return array Number field types @since 2.3.0
[ "Get", "list", "of", "available", "number", "field", "types" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1706-L1717
train
pods-framework/pods
classes/PodsForm.php
PodsForm.date_field_types
public static function date_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'date', 'datetime', 'time' ); $field_types = apply_filters( 'pods_tableless_field_types', $field_types ); } return $field_types; }
php
public static function date_field_types() { static $field_types = null; if ( null === $field_types ) { $field_types = array( 'date', 'datetime', 'time' ); $field_types = apply_filters( 'pods_tableless_field_types', $field_types ); } return $field_types; }
[ "public", "static", "function", "date_field_types", "(", ")", "{", "static", "$", "field_types", "=", "null", ";", "if", "(", "null", "===", "$", "field_types", ")", "{", "$", "field_types", "=", "array", "(", "'date'", ",", "'datetime'", ",", "'time'", ...
Get list of available date field types @return array Date field types @since 2.3.0
[ "Get", "list", "of", "available", "date", "field", "types" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/PodsForm.php#L1726-L1737
train
pods-framework/pods
classes/fields/file.php
PodsField_File.markup
public function markup( $attributes, $limit = 1, $editable = true, $id = null, $icon = null, $name = null, $linked = false, $link = null ) { _doing_it_wrong( 'PodsField_File::markup', esc_html__( 'This method has been deprecated and will be removed from Pods 3.0', 'pods' ), '2.7' ); // Preserve current file type. $field_type = PodsForm::$field_type; ob_start(); if ( empty( $id ) ) { $id = '{{id}}'; } if ( empty( $icon ) ) { $icon = '{{icon}}'; } if ( empty( $name ) ) { $name = '{{name}}'; } if ( empty( $link ) ) { $link = '{{link}}'; } $editable = (boolean) $editable; $linked = (boolean) $linked; ?> <li class="pods-file hidden" id="pods-file-<?php echo esc_attr( $id ); ?>"> <?php // @codingStandardsIgnoreLine echo PodsForm::field( $attributes['name'] . '[' . $id . '][id]', $id, 'hidden' ); ?> <ul class="pods-file-meta media-item"> <?php if ( 1 !== (int) $limit ) { ?> <li class="pods-file-col pods-file-handle">Handle</li> <?php } ?> <li class="pods-file-col pods-file-icon"> <img class="pinkynail" src="<?php echo esc_url( $icon ); ?>" alt="Icon" /> </li> <li class="pods-file-col pods-file-name"> <?php if ( $editable ) { // @codingStandardsIgnoreLine echo PodsForm::field( $attributes['name'] . '[' . $id . '][title]', $name, 'text' ); } else { echo esc_html( $name ); } ?> </li> <li class="pods-file-col pods-file-actions"> <ul> <li class="pods-file-col pods-file-delete"><a href="#delete">Delete</a></li> <?php if ( $linked ) { ?> <li class="pods-file-col pods-file-download"> <a href="<?php echo esc_url( $link ); ?>" target="_blank">Download</a></li> <?php } ?> </ul> </li> </ul> </li> <?php PodsForm::$field_type = $field_type; return ob_get_clean(); }
php
public function markup( $attributes, $limit = 1, $editable = true, $id = null, $icon = null, $name = null, $linked = false, $link = null ) { _doing_it_wrong( 'PodsField_File::markup', esc_html__( 'This method has been deprecated and will be removed from Pods 3.0', 'pods' ), '2.7' ); // Preserve current file type. $field_type = PodsForm::$field_type; ob_start(); if ( empty( $id ) ) { $id = '{{id}}'; } if ( empty( $icon ) ) { $icon = '{{icon}}'; } if ( empty( $name ) ) { $name = '{{name}}'; } if ( empty( $link ) ) { $link = '{{link}}'; } $editable = (boolean) $editable; $linked = (boolean) $linked; ?> <li class="pods-file hidden" id="pods-file-<?php echo esc_attr( $id ); ?>"> <?php // @codingStandardsIgnoreLine echo PodsForm::field( $attributes['name'] . '[' . $id . '][id]', $id, 'hidden' ); ?> <ul class="pods-file-meta media-item"> <?php if ( 1 !== (int) $limit ) { ?> <li class="pods-file-col pods-file-handle">Handle</li> <?php } ?> <li class="pods-file-col pods-file-icon"> <img class="pinkynail" src="<?php echo esc_url( $icon ); ?>" alt="Icon" /> </li> <li class="pods-file-col pods-file-name"> <?php if ( $editable ) { // @codingStandardsIgnoreLine echo PodsForm::field( $attributes['name'] . '[' . $id . '][title]', $name, 'text' ); } else { echo esc_html( $name ); } ?> </li> <li class="pods-file-col pods-file-actions"> <ul> <li class="pods-file-col pods-file-delete"><a href="#delete">Delete</a></li> <?php if ( $linked ) { ?> <li class="pods-file-col pods-file-download"> <a href="<?php echo esc_url( $link ); ?>" target="_blank">Download</a></li> <?php } ?> </ul> </li> </ul> </li> <?php PodsForm::$field_type = $field_type; return ob_get_clean(); }
[ "public", "function", "markup", "(", "$", "attributes", ",", "$", "limit", "=", "1", ",", "$", "editable", "=", "true", ",", "$", "id", "=", "null", ",", "$", "icon", "=", "null", ",", "$", "name", "=", "null", ",", "$", "linked", "=", "false", ...
Handle file row output for uploaders @param array $attributes Field options. @param int $limit List limit. @param bool $editable Whether the items should be editable. @param null|int|string $id Item ID. @param null|string $icon Icon URL. @param null|string $name File name. @param bool $linked Whether the items should be linked. @param null|string $link Link URL. @return string @since 2.0.0 @deprecated 2.7.0
[ "Handle", "file", "row", "output", "for", "uploaders" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/classes/fields/file.php#L797-L871
train
pods-framework/pods
components/Templates/Templates.php
Pods_Templates.do_template
public static function do_template( $code, $obj = null ) { if ( ! empty( $obj ) ) { self::$obj =& $obj; } else { $obj =& self::$obj; } if ( empty( $obj ) || ! is_object( $obj ) ) { return ''; } $code = trim( $code ); if ( false !== strpos( $code, '<?' ) && ( ! defined( 'PODS_DISABLE_EVAL' ) || ! PODS_DISABLE_EVAL ) ) { pods_deprecated( 'Pod Template PHP code has been deprecated, please use WP Templates instead of embedding PHP.', '2.3' ); $code = str_replace( '$this->', '$obj->', $code ); ob_start(); eval( "?>$code" ); $out = ob_get_clean(); } else { $out = $code; } $out = $obj->do_magic_tags( $out ); return apply_filters( 'pods_templates_do_template', $out, $code, $obj ); }
php
public static function do_template( $code, $obj = null ) { if ( ! empty( $obj ) ) { self::$obj =& $obj; } else { $obj =& self::$obj; } if ( empty( $obj ) || ! is_object( $obj ) ) { return ''; } $code = trim( $code ); if ( false !== strpos( $code, '<?' ) && ( ! defined( 'PODS_DISABLE_EVAL' ) || ! PODS_DISABLE_EVAL ) ) { pods_deprecated( 'Pod Template PHP code has been deprecated, please use WP Templates instead of embedding PHP.', '2.3' ); $code = str_replace( '$this->', '$obj->', $code ); ob_start(); eval( "?>$code" ); $out = ob_get_clean(); } else { $out = $code; } $out = $obj->do_magic_tags( $out ); return apply_filters( 'pods_templates_do_template', $out, $code, $obj ); }
[ "public", "static", "function", "do_template", "(", "$", "code", ",", "$", "obj", "=", "null", ")", "{", "if", "(", "!", "empty", "(", "$", "obj", ")", ")", "{", "self", "::", "$", "obj", "=", "&", "$", "obj", ";", "}", "else", "{", "$", "obj...
Parse a template string @param string $code The template string to parse @param object $obj The Pods object @since 1.8.5 @return mixed|string|void
[ "Parse", "a", "template", "string" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Templates/Templates.php#L572-L603
train
pods-framework/pods
components/Migrate-CPTUI/Migrate-CPTUI.php
Pods_Migrate_CPTUI.admin
public function admin( $options, $component ) { $post_types = (array) $this->post_types; $taxonomies = (array) $this->taxonomies; $method = 'migrate'; // ajax_migrate pods_view( PODS_DIR . 'components/Migrate-CPTUI/ui/wizard.php', compact( array_keys( get_defined_vars() ) ) ); }
php
public function admin( $options, $component ) { $post_types = (array) $this->post_types; $taxonomies = (array) $this->taxonomies; $method = 'migrate'; // ajax_migrate pods_view( PODS_DIR . 'components/Migrate-CPTUI/ui/wizard.php', compact( array_keys( get_defined_vars() ) ) ); }
[ "public", "function", "admin", "(", "$", "options", ",", "$", "component", ")", "{", "$", "post_types", "=", "(", "array", ")", "$", "this", "->", "post_types", ";", "$", "taxonomies", "=", "(", "array", ")", "$", "this", "->", "taxonomies", ";", "$"...
Show the Admin @param $options @param $component
[ "Show", "the", "Admin" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Migrate-CPTUI/Migrate-CPTUI.php#L88-L96
train
pods-framework/pods
components/Migrate-CPTUI/Migrate-CPTUI.php
Pods_Migrate_CPTUI.ajax_migrate
public function ajax_migrate( $params ) { $post_types = (array) $this->post_types; $taxonomies = (array) $this->taxonomies; $migrate_post_types = array(); if ( isset( $params->post_type ) && ! empty( $params->post_type ) ) { foreach ( $params->post_type as $post_type => $checked ) { if ( true === (boolean) $checked ) { $migrate_post_types[] = $post_type; } } } $migrate_taxonomies = array(); if ( isset( $params->taxonomy ) && ! empty( $params->taxonomy ) ) { foreach ( $params->taxonomy as $taxonomy => $checked ) { if ( true === (boolean) $checked ) { $migrate_taxonomies[] = $taxonomy; } } } foreach ( $post_types as $k => $post_type ) { if ( ! in_array( pods_var( 'name', $post_type ), $migrate_post_types, true ) ) { continue; } $id = $this->migrate_post_type( $post_type ); if ( 0 < $id ) { unset( $post_types[ $k ] ); } } foreach ( $taxonomies as $k => $taxonomy ) { if ( ! in_array( pods_var( 'name', $taxonomy ), $migrate_taxonomies, true ) ) { continue; } $id = $this->migrate_taxonomy( $taxonomy ); if ( 0 < $id ) { unset( $taxonomies[ $k ] ); } } if ( 1 == pods_var( 'cleanup', $params, 0 ) ) { if ( ! empty( $post_types ) ) { if ( ! is_null( $this->post_option_name ) ) { update_option( $this->post_option_name, $post_types ); } } else { if ( ! is_null( $this->post_option_name ) ) { delete_option( $this->post_option_name ); } } if ( ! empty( $taxonomies ) ) { if ( ! is_null( $this->taxonomy_option_name ) ) { update_option( $this->taxonomy_option_name, $taxonomies ); } } else { if ( ! is_null( $this->taxonomy_option_name ) ) { delete_option( $this->taxonomy_option_name ); } } }//end if }
php
public function ajax_migrate( $params ) { $post_types = (array) $this->post_types; $taxonomies = (array) $this->taxonomies; $migrate_post_types = array(); if ( isset( $params->post_type ) && ! empty( $params->post_type ) ) { foreach ( $params->post_type as $post_type => $checked ) { if ( true === (boolean) $checked ) { $migrate_post_types[] = $post_type; } } } $migrate_taxonomies = array(); if ( isset( $params->taxonomy ) && ! empty( $params->taxonomy ) ) { foreach ( $params->taxonomy as $taxonomy => $checked ) { if ( true === (boolean) $checked ) { $migrate_taxonomies[] = $taxonomy; } } } foreach ( $post_types as $k => $post_type ) { if ( ! in_array( pods_var( 'name', $post_type ), $migrate_post_types, true ) ) { continue; } $id = $this->migrate_post_type( $post_type ); if ( 0 < $id ) { unset( $post_types[ $k ] ); } } foreach ( $taxonomies as $k => $taxonomy ) { if ( ! in_array( pods_var( 'name', $taxonomy ), $migrate_taxonomies, true ) ) { continue; } $id = $this->migrate_taxonomy( $taxonomy ); if ( 0 < $id ) { unset( $taxonomies[ $k ] ); } } if ( 1 == pods_var( 'cleanup', $params, 0 ) ) { if ( ! empty( $post_types ) ) { if ( ! is_null( $this->post_option_name ) ) { update_option( $this->post_option_name, $post_types ); } } else { if ( ! is_null( $this->post_option_name ) ) { delete_option( $this->post_option_name ); } } if ( ! empty( $taxonomies ) ) { if ( ! is_null( $this->taxonomy_option_name ) ) { update_option( $this->taxonomy_option_name, $taxonomies ); } } else { if ( ! is_null( $this->taxonomy_option_name ) ) { delete_option( $this->taxonomy_option_name ); } } }//end if }
[ "public", "function", "ajax_migrate", "(", "$", "params", ")", "{", "$", "post_types", "=", "(", "array", ")", "$", "this", "->", "post_types", ";", "$", "taxonomies", "=", "(", "array", ")", "$", "this", "->", "taxonomies", ";", "$", "migrate_post_types...
Handle the Migration AJAX @param $params
[ "Handle", "the", "Migration", "AJAX" ]
fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c
https://github.com/pods-framework/pods/blob/fd9a07c5c81ccbfcb21c5a0b2166f96c31d0826c/components/Migrate-CPTUI/Migrate-CPTUI.php#L103-L173
train
davidhemphill/presenter
src/Presentable.php
Presentable.present
public function present($presenter = null) { if (! $presenter) { if (! $this->defaultPresenter) { throw new \BadMethodCallException('No presenter or default presenter passed to present()'); } $presenter = $this->defaultPresenter; } $factory = new PresenterFactory(); return $factory($this, $presenter); }
php
public function present($presenter = null) { if (! $presenter) { if (! $this->defaultPresenter) { throw new \BadMethodCallException('No presenter or default presenter passed to present()'); } $presenter = $this->defaultPresenter; } $factory = new PresenterFactory(); return $factory($this, $presenter); }
[ "public", "function", "present", "(", "$", "presenter", "=", "null", ")", "{", "if", "(", "!", "$", "presenter", ")", "{", "if", "(", "!", "$", "this", "->", "defaultPresenter", ")", "{", "throw", "new", "\\", "BadMethodCallException", "(", "'No presente...
Present this instance using the provided Presenter class. @param string $presenter @return Hemp\Presenter
[ "Present", "this", "instance", "using", "the", "provided", "Presenter", "class", "." ]
629dfa08653b92e17c42bfb808af2b83109e90aa
https://github.com/davidhemphill/presenter/blob/629dfa08653b92e17c42bfb808af2b83109e90aa/src/Presentable.php#L14-L26
train
davidhemphill/presenter
src/Presenter.php
Presenter.toArray
public function toArray() { $mutatedAttributes = $this->mutatorsToArray(); $all = array_merge($this->model->toArray(), $mutatedAttributes); if (! static::$snakeAttributes) { $all = array_combine( array_map(function ($k) { return Str::camel($k); }, array_keys($all)), $all ); } $items = $this->getArrayableItems($all); if (! static::$snakeAttributes) { $items = array_combine( array_map(function ($k) { return Str::camel($k); }, array_keys($items)), $items ); } return array_intersect_key($all, $items); }
php
public function toArray() { $mutatedAttributes = $this->mutatorsToArray(); $all = array_merge($this->model->toArray(), $mutatedAttributes); if (! static::$snakeAttributes) { $all = array_combine( array_map(function ($k) { return Str::camel($k); }, array_keys($all)), $all ); } $items = $this->getArrayableItems($all); if (! static::$snakeAttributes) { $items = array_combine( array_map(function ($k) { return Str::camel($k); }, array_keys($items)), $items ); } return array_intersect_key($all, $items); }
[ "public", "function", "toArray", "(", ")", "{", "$", "mutatedAttributes", "=", "$", "this", "->", "mutatorsToArray", "(", ")", ";", "$", "all", "=", "array_merge", "(", "$", "this", "->", "model", "->", "toArray", "(", ")", ",", "$", "mutatedAttributes",...
Convert the decorator instance to an array. @return array
[ "Convert", "the", "decorator", "instance", "to", "an", "array", "." ]
629dfa08653b92e17c42bfb808af2b83109e90aa
https://github.com/davidhemphill/presenter/blob/629dfa08653b92e17c42bfb808af2b83109e90aa/src/Presenter.php#L169-L195
train
davidhemphill/presenter
src/Presenter.php
Presenter.mutatorsToArray
public function mutatorsToArray() { $mutatedAttributes = []; $mutators = $this->getMutatedAttributes(); foreach ($mutators as $mutator) { $mutatedAttributes[Str::snake($mutator)] = $this->mutateAttribute($mutator); } return $mutatedAttributes; }
php
public function mutatorsToArray() { $mutatedAttributes = []; $mutators = $this->getMutatedAttributes(); foreach ($mutators as $mutator) { $mutatedAttributes[Str::snake($mutator)] = $this->mutateAttribute($mutator); } return $mutatedAttributes; }
[ "public", "function", "mutatorsToArray", "(", ")", "{", "$", "mutatedAttributes", "=", "[", "]", ";", "$", "mutators", "=", "$", "this", "->", "getMutatedAttributes", "(", ")", ";", "foreach", "(", "$", "mutators", "as", "$", "mutator", ")", "{", "$", ...
Convert the decorators instance's mutators to an array. @return array
[ "Convert", "the", "decorators", "instance", "s", "mutators", "to", "an", "array", "." ]
629dfa08653b92e17c42bfb808af2b83109e90aa
https://github.com/davidhemphill/presenter/blob/629dfa08653b92e17c42bfb808af2b83109e90aa/src/Presenter.php#L202-L213
train
unicodeveloper/laravel-password
src/DumbPasswordServiceProvider.php
DumbPasswordServiceProvider.boot
public function boot() { Validator::extend('dumbpwd', function ($attribute, $value, $parameters, $validator) { $path = realpath(__DIR__ . '/../resources/config/passwordlist.txt'); $cache_key = md5_file($path); $data = Cache::rememberForever('dumbpwd_list_' . $cache_key, function () use ($path) { return collect(explode("\n", file_get_contents($path))); }); return !$data->contains($value); }, $this->message); }
php
public function boot() { Validator::extend('dumbpwd', function ($attribute, $value, $parameters, $validator) { $path = realpath(__DIR__ . '/../resources/config/passwordlist.txt'); $cache_key = md5_file($path); $data = Cache::rememberForever('dumbpwd_list_' . $cache_key, function () use ($path) { return collect(explode("\n", file_get_contents($path))); }); return !$data->contains($value); }, $this->message); }
[ "public", "function", "boot", "(", ")", "{", "Validator", "::", "extend", "(", "'dumbpwd'", ",", "function", "(", "$", "attribute", ",", "$", "value", ",", "$", "parameters", ",", "$", "validator", ")", "{", "$", "path", "=", "realpath", "(", "__DIR__"...
Publishes all the config file this package needs to function.
[ "Publishes", "all", "the", "config", "file", "this", "package", "needs", "to", "function", "." ]
c2e532cbbb0c579f5a9fabd105edb4185b192cf2
https://github.com/unicodeveloper/laravel-password/blob/c2e532cbbb0c579f5a9fabd105edb4185b192cf2/src/DumbPasswordServiceProvider.php#L37-L47
train
silverstripe/cwp
src/Tasks/PopulateThemeSampleDataTask.php
PopulateThemeSampleDataTask.getContactFormExists
protected function getContactFormExists() { $exists = false; foreach (UserDefinedForm::get()->column('ID') as $formId) { $count = Versioned::get_all_versions(UserDefinedForm::class, $formId) ->filter('URLSegment', 'contact') ->count(); if ($count >= 1) { $exists = true; break; } } return $exists; }
php
protected function getContactFormExists() { $exists = false; foreach (UserDefinedForm::get()->column('ID') as $formId) { $count = Versioned::get_all_versions(UserDefinedForm::class, $formId) ->filter('URLSegment', 'contact') ->count(); if ($count >= 1) { $exists = true; break; } } return $exists; }
[ "protected", "function", "getContactFormExists", "(", ")", "{", "$", "exists", "=", "false", ";", "foreach", "(", "UserDefinedForm", "::", "get", "(", ")", "->", "column", "(", "'ID'", ")", "as", "$", "formId", ")", "{", "$", "count", "=", "Versioned", ...
Determine whether a "contact us" userform exists yet @return bool
[ "Determine", "whether", "a", "contact", "us", "userform", "exists", "yet" ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/Tasks/PopulateThemeSampleDataTask.php#L56-L70
train
silverstripe/cwp
src/Tasks/PopulateThemeSampleDataTask.php
PopulateThemeSampleDataTask.createContactForm
protected function createContactForm() { $form = UserDefinedForm::create(array( 'Title' => 'Contact', 'URLSegment' => 'contact', 'Content' => '<p>$UserDefinedForm</p>', 'SubmitButtonText' => 'Submit', 'ClearButtonText' => 'Clear', 'OnCompleteMessage' => "<p>Thanks, we've received your submission and will be in touch shortly.</p>", 'EnableLiveValidation' => true )); $form->write(); // Add form fields $fields = array( EditableFormStep::create([ 'Title' => _t( 'SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep.TITLE_FIRST', 'First Page' ) ]), EditableTextField::create([ 'Title' => 'Name', 'Required' => true, 'RightTitle' => 'Please enter your first and last name' ]), EditableEmailField::create([ 'Title' => Email::class, 'Required' => true, 'Placeholder' => 'example@example.com' ]), EditableTextField::create([ 'Title' => 'Subject' ]), EditableTextField::create([ 'Title' => 'Message', 'Required' => true, 'Rows' => 5 ]) ); foreach ($fields as $field) { $field->write(); $form->Fields()->add($field); $field->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); } $form->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); $form->flushCache(); $this->output(' + Created "contact" UserDefinedForm page'); return $this; }
php
protected function createContactForm() { $form = UserDefinedForm::create(array( 'Title' => 'Contact', 'URLSegment' => 'contact', 'Content' => '<p>$UserDefinedForm</p>', 'SubmitButtonText' => 'Submit', 'ClearButtonText' => 'Clear', 'OnCompleteMessage' => "<p>Thanks, we've received your submission and will be in touch shortly.</p>", 'EnableLiveValidation' => true )); $form->write(); // Add form fields $fields = array( EditableFormStep::create([ 'Title' => _t( 'SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep.TITLE_FIRST', 'First Page' ) ]), EditableTextField::create([ 'Title' => 'Name', 'Required' => true, 'RightTitle' => 'Please enter your first and last name' ]), EditableEmailField::create([ 'Title' => Email::class, 'Required' => true, 'Placeholder' => 'example@example.com' ]), EditableTextField::create([ 'Title' => 'Subject' ]), EditableTextField::create([ 'Title' => 'Message', 'Required' => true, 'Rows' => 5 ]) ); foreach ($fields as $field) { $field->write(); $form->Fields()->add($field); $field->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); } $form->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); $form->flushCache(); $this->output(' + Created "contact" UserDefinedForm page'); return $this; }
[ "protected", "function", "createContactForm", "(", ")", "{", "$", "form", "=", "UserDefinedForm", "::", "create", "(", "array", "(", "'Title'", "=>", "'Contact'", ",", "'URLSegment'", "=>", "'contact'", ",", "'Content'", "=>", "'<p>$UserDefinedForm</p>'", ",", "...
Create a "contact us" userform. Please note that this form does not have any recipients by default, so no emails will be sent. To add recipients - edit the page in the CMS and add a recipient via the "Recipients" tab. @return $this
[ "Create", "a", "contact", "us", "userform", ".", "Please", "note", "that", "this", "form", "does", "not", "have", "any", "recipients", "by", "default", "so", "no", "emails", "will", "be", "sent", ".", "To", "add", "recipients", "-", "edit", "the", "page"...
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/Tasks/PopulateThemeSampleDataTask.php#L79-L133
train
silverstripe/cwp
src/Tasks/PopulateThemeSampleDataTask.php
PopulateThemeSampleDataTask.output
protected function output($message) { if (Director::is_cli()) { $message .= PHP_EOL; } else { $message = sprintf('<p>%s</p>', $message); } echo $message; return $this; }
php
protected function output($message) { if (Director::is_cli()) { $message .= PHP_EOL; } else { $message = sprintf('<p>%s</p>', $message); } echo $message; return $this; }
[ "protected", "function", "output", "(", "$", "message", ")", "{", "if", "(", "Director", "::", "is_cli", "(", ")", ")", "{", "$", "message", ".=", "PHP_EOL", ";", "}", "else", "{", "$", "message", "=", "sprintf", "(", "'<p>%s</p>'", ",", "$", "messag...
Output a message either to the console or browser @param string $message @return $this
[ "Output", "a", "message", "either", "to", "the", "console", "or", "browser" ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/Tasks/PopulateThemeSampleDataTask.php#L141-L151
train
silverstripe/cwp
src/PageTypes/NewsHolder.php
NewsHolder.AllUpdates
public static function AllUpdates( $className = NewsPage::class, $parentID = null, $tagID = null, $dateFrom = null, $dateTo = null, $year = null, $monthNumber = null ) { return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber) ->Sort('Date', 'DESC'); }
php
public static function AllUpdates( $className = NewsPage::class, $parentID = null, $tagID = null, $dateFrom = null, $dateTo = null, $year = null, $monthNumber = null ) { return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber) ->Sort('Date', 'DESC'); }
[ "public", "static", "function", "AllUpdates", "(", "$", "className", "=", "NewsPage", "::", "class", ",", "$", "parentID", "=", "null", ",", "$", "tagID", "=", "null", ",", "$", "dateFrom", "=", "null", ",", "$", "dateTo", "=", "null", ",", "$", "yea...
Find all site's news items, based on some filters. Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. @param string $className The name of the class to fetch. @param int $parentID The ID of the holder to extract the news items from. @param int $tagID The ID of the tag to filter the news items by. @param string $dateFrom The beginning of a date filter range. @param string $dateTo The end of the date filter range. If empty, only one day will be searched for. @param int $year Numeric value of the year to show. @param int $monthNumber Numeric value of the month to show. @returns DataList|PaginatedList
[ "Find", "all", "site", "s", "news", "items", "based", "on", "some", "filters", ".", "Omitting", "parameters", "will", "prevent", "relevant", "filters", "from", "being", "applied", ".", "The", "filters", "are", "ANDed", "together", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/NewsHolder.php#L44-L55
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolderController.php
DatedUpdateHolderController.getMetaTitle
public function getMetaTitle() { $title = $this->data()->getTitle(); $filter = $this->FilterDescription(); if ($filter) { $title = "{$title} - {$filter}"; } $this->extend('updateMetaTitle', $title); return $title; }
php
public function getMetaTitle() { $title = $this->data()->getTitle(); $filter = $this->FilterDescription(); if ($filter) { $title = "{$title} - {$filter}"; } $this->extend('updateMetaTitle', $title); return $title; }
[ "public", "function", "getMetaTitle", "(", ")", "{", "$", "title", "=", "$", "this", "->", "data", "(", ")", "->", "getTitle", "(", ")", ";", "$", "filter", "=", "$", "this", "->", "FilterDescription", "(", ")", ";", "if", "(", "$", "filter", ")", ...
Get the meta title for the current action @return string
[ "Get", "the", "meta", "title", "for", "the", "current", "action" ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolderController.php#L60-L70
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolderController.php
DatedUpdateHolderController.FilterDescription
public function FilterDescription() { $params = $this->parseParams(); $filters = array(); if ($params['tag']) { $term = TaxonomyTerm::get_by_id(TaxonomyTerm::class, $params['tag']); if ($term) { $filters[] = _t( 'CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_WITHIN', 'within' ) . ' "' . $term->Name . '"'; } } if ($params['from'] || $params['to']) { if ($params['from']) { $from = strtotime($params['from']); if ($params['to']) { $to = strtotime($params['to']); $filters[] = _t('CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_BETWEEN', 'between') . ' ' . date('j/m/Y', $from) . ' and ' . date('j/m/Y', $to); } else { $filters[] = _t('CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_ON', 'on') . ' ' . date('j/m/Y', $from); } } else { $to = strtotime($params['to']); $filters[] = _t('CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_ON', 'on') . ' ' . date('j/m/Y', $to); } } if ($params['year'] && $params['month']) { $timestamp = mktime(1, 1, 1, $params['month'], 1, $params['year']); $filters[] = _t('CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_IN', 'in') . ' ' . date('F', $timestamp) . ' ' . $params['year']; } if ($filters) { return $this->getUpdateName() . ' ' . implode(' ', $filters); } }
php
public function FilterDescription() { $params = $this->parseParams(); $filters = array(); if ($params['tag']) { $term = TaxonomyTerm::get_by_id(TaxonomyTerm::class, $params['tag']); if ($term) { $filters[] = _t( 'CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_WITHIN', 'within' ) . ' "' . $term->Name . '"'; } } if ($params['from'] || $params['to']) { if ($params['from']) { $from = strtotime($params['from']); if ($params['to']) { $to = strtotime($params['to']); $filters[] = _t('CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_BETWEEN', 'between') . ' ' . date('j/m/Y', $from) . ' and ' . date('j/m/Y', $to); } else { $filters[] = _t('CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_ON', 'on') . ' ' . date('j/m/Y', $from); } } else { $to = strtotime($params['to']); $filters[] = _t('CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_ON', 'on') . ' ' . date('j/m/Y', $to); } } if ($params['year'] && $params['month']) { $timestamp = mktime(1, 1, 1, $params['month'], 1, $params['year']); $filters[] = _t('CWP\\CWP\\PageTypes\\DatedUpdateHolder.FILTER_IN', 'in') . ' ' . date('F', $timestamp) . ' ' . $params['year']; } if ($filters) { return $this->getUpdateName() . ' ' . implode(' ', $filters); } }
[ "public", "function", "FilterDescription", "(", ")", "{", "$", "params", "=", "$", "this", "->", "parseParams", "(", ")", ";", "$", "filters", "=", "array", "(", ")", ";", "if", "(", "$", "params", "[", "'tag'", "]", ")", "{", "$", "term", "=", "...
Returns a description of the current filter @return string
[ "Returns", "a", "description", "of", "the", "current", "filter" ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolderController.php#L77-L119
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolderController.php
DatedUpdateHolderController.AllTagsLink
public function AllTagsLink() { $link = HTTP::setGetVar('tag', null, null, '&'); $link = HTTP::setGetVar('month', null, $link, '&'); $link = HTTP::setGetVar('year', null, $link, '&'); $link = HTTP::setGetVar('start', null, $link, '&'); return $link; }
php
public function AllTagsLink() { $link = HTTP::setGetVar('tag', null, null, '&'); $link = HTTP::setGetVar('month', null, $link, '&'); $link = HTTP::setGetVar('year', null, $link, '&'); $link = HTTP::setGetVar('start', null, $link, '&'); return $link; }
[ "public", "function", "AllTagsLink", "(", ")", "{", "$", "link", "=", "HTTP", "::", "setGetVar", "(", "'tag'", ",", "null", ",", "null", ",", "'&'", ")", ";", "$", "link", "=", "HTTP", "::", "setGetVar", "(", "'month'", ",", "null", ",", "$", "link...
Build the link - keep the date range, reset the rest.
[ "Build", "the", "link", "-", "keep", "the", "date", "range", "reset", "the", "rest", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolderController.php#L222-L230
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolderController.php
DatedUpdateHolderController.UpdateTagsWithLinks
public function UpdateTagsWithLinks() { $tags = $this->UpdateTags(); $processed = ArrayList::create(); foreach ($tags as $tag) { // Build the link - keep the tag, and date range, but reset month, year and pagination. $link = HTTP::setGetVar('tag', $tag->ID, null, '&'); $link = HTTP::setGetVar('month', null, $link, '&'); $link = HTTP::setGetVar('year', null, $link, '&'); $link = HTTP::setGetVar('start', null, $link, '&'); $tag->Link = $link; $processed->push($tag); } return $processed; }
php
public function UpdateTagsWithLinks() { $tags = $this->UpdateTags(); $processed = ArrayList::create(); foreach ($tags as $tag) { // Build the link - keep the tag, and date range, but reset month, year and pagination. $link = HTTP::setGetVar('tag', $tag->ID, null, '&'); $link = HTTP::setGetVar('month', null, $link, '&'); $link = HTTP::setGetVar('year', null, $link, '&'); $link = HTTP::setGetVar('start', null, $link, '&'); $tag->Link = $link; $processed->push($tag); } return $processed; }
[ "public", "function", "UpdateTagsWithLinks", "(", ")", "{", "$", "tags", "=", "$", "this", "->", "UpdateTags", "(", ")", ";", "$", "processed", "=", "ArrayList", "::", "create", "(", ")", ";", "foreach", "(", "$", "tags", "as", "$", "tag", ")", "{", ...
List tags and attach links.
[ "List", "tags", "and", "attach", "links", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolderController.php#L235-L253
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolderController.php
DatedUpdateHolderController.CurrentTag
public function CurrentTag() { $tagID = $this->request->getVar('tag'); if (isset($tagID)) { return TaxonomyTerm::get_by_id(TaxonomyTerm::class, (int)$tagID); } }
php
public function CurrentTag() { $tagID = $this->request->getVar('tag'); if (isset($tagID)) { return TaxonomyTerm::get_by_id(TaxonomyTerm::class, (int)$tagID); } }
[ "public", "function", "CurrentTag", "(", ")", "{", "$", "tagID", "=", "$", "this", "->", "request", "->", "getVar", "(", "'tag'", ")", ";", "if", "(", "isset", "(", "$", "tagID", ")", ")", "{", "return", "TaxonomyTerm", "::", "get_by_id", "(", "Taxon...
Get the TaxonomyTerm related to the current tag GET parameter.
[ "Get", "the", "TaxonomyTerm", "related", "to", "the", "current", "tag", "GET", "parameter", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolderController.php#L258-L265
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolderController.php
DatedUpdateHolderController.AvailableMonths
public function AvailableMonths() { $params = $this->parseParams(); return DatedUpdateHolder::ExtractMonths( $this->Updates($params['tag'], $params['from'], $params['to']), Director::makeRelative($_SERVER['REQUEST_URI']), $params['year'], $params['month'] ); }
php
public function AvailableMonths() { $params = $this->parseParams(); return DatedUpdateHolder::ExtractMonths( $this->Updates($params['tag'], $params['from'], $params['to']), Director::makeRelative($_SERVER['REQUEST_URI']), $params['year'], $params['month'] ); }
[ "public", "function", "AvailableMonths", "(", ")", "{", "$", "params", "=", "$", "this", "->", "parseParams", "(", ")", ";", "return", "DatedUpdateHolder", "::", "ExtractMonths", "(", "$", "this", "->", "Updates", "(", "$", "params", "[", "'tag'", "]", "...
Extract the available months based on the current query. Only tag is respected. Pagination and months are ignored.
[ "Extract", "the", "available", "months", "based", "on", "the", "current", "query", ".", "Only", "tag", "is", "respected", ".", "Pagination", "and", "months", "are", "ignored", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolderController.php#L271-L281
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolderController.php
DatedUpdateHolderController.FilteredUpdates
public function FilteredUpdates($pageSize = 20) { $params = $this->parseParams(); $items = $this->Updates( $params['tag'], $params['from'], $params['to'], $params['year'], $params['month'] ); // Apply pagination $list = PaginatedList::create($items, $this->getRequest()); $list->setPageLength($pageSize); return $list; }
php
public function FilteredUpdates($pageSize = 20) { $params = $this->parseParams(); $items = $this->Updates( $params['tag'], $params['from'], $params['to'], $params['year'], $params['month'] ); // Apply pagination $list = PaginatedList::create($items, $this->getRequest()); $list->setPageLength($pageSize); return $list; }
[ "public", "function", "FilteredUpdates", "(", "$", "pageSize", "=", "20", ")", "{", "$", "params", "=", "$", "this", "->", "parseParams", "(", ")", ";", "$", "items", "=", "$", "this", "->", "Updates", "(", "$", "params", "[", "'tag'", "]", ",", "$...
Get the updates based on the current query.
[ "Get", "the", "updates", "based", "on", "the", "current", "query", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolderController.php#L286-L302
train
silverstripe/cwp
src/Report/CwpStatsReport.php
CwpStatsReport.sourceRecords
public function sourceRecords($params = [], $sort = null, $limit = null) { $records = []; // Get the query to apply across all variants: looks at all subsites, translations, live stage only. $crossVariant = (function ($dataQuery) { $params = [ 'Subsite.filter' => false, 'Versioned.mode' => 'stage', 'Versioned.stage' => Versioned::LIVE, ]; return $dataQuery->setDataQueryParam($params); }); // Total. $records[] = [ 'Name' => _t( __CLASS__ . '.TotalPageCount', 'Total live page count, across all translations and subsites' ), 'Count' => $crossVariant(SiteTree::get())->count(), ]; if (class_exists(Subsite::class)) { // Main site. $records[] = [ 'Name' => _t(__CLASS__ . '.PagesForMainSite', '- in the main site'), 'Count' => $crossVariant(SiteTree::get()) ->filter(['SubsiteID' => 0]) ->count(), ]; // Per subsite. $subsites = Subsite::get(); foreach ($subsites as $subsite) { $records[] = [ 'Name' => _t( __CLASS__ . '.PagesForSubsite', "- in the subsite '{SubsiteTitle}'", ['SubsiteTitle' => $subsite->Title] ), 'Count' => $crossVariant(SiteTree::get()) ->filter(['SubsiteID' => $subsite->ID]) ->count(), ]; } } // Files. $records[] = [ 'Name' => _t(__CLASS__ . '.FileCount', 'File count'), 'Count' => File::get() ->setDataQueryParam('Subsite.filter', false) ->filter(['ClassName:not' => Folder::class]) ->count(), ]; return ArrayList::create($records); }
php
public function sourceRecords($params = [], $sort = null, $limit = null) { $records = []; // Get the query to apply across all variants: looks at all subsites, translations, live stage only. $crossVariant = (function ($dataQuery) { $params = [ 'Subsite.filter' => false, 'Versioned.mode' => 'stage', 'Versioned.stage' => Versioned::LIVE, ]; return $dataQuery->setDataQueryParam($params); }); // Total. $records[] = [ 'Name' => _t( __CLASS__ . '.TotalPageCount', 'Total live page count, across all translations and subsites' ), 'Count' => $crossVariant(SiteTree::get())->count(), ]; if (class_exists(Subsite::class)) { // Main site. $records[] = [ 'Name' => _t(__CLASS__ . '.PagesForMainSite', '- in the main site'), 'Count' => $crossVariant(SiteTree::get()) ->filter(['SubsiteID' => 0]) ->count(), ]; // Per subsite. $subsites = Subsite::get(); foreach ($subsites as $subsite) { $records[] = [ 'Name' => _t( __CLASS__ . '.PagesForSubsite', "- in the subsite '{SubsiteTitle}'", ['SubsiteTitle' => $subsite->Title] ), 'Count' => $crossVariant(SiteTree::get()) ->filter(['SubsiteID' => $subsite->ID]) ->count(), ]; } } // Files. $records[] = [ 'Name' => _t(__CLASS__ . '.FileCount', 'File count'), 'Count' => File::get() ->setDataQueryParam('Subsite.filter', false) ->filter(['ClassName:not' => Folder::class]) ->count(), ]; return ArrayList::create($records); }
[ "public", "function", "sourceRecords", "(", "$", "params", "=", "[", "]", ",", "$", "sort", "=", "null", ",", "$", "limit", "=", "null", ")", "{", "$", "records", "=", "[", "]", ";", "// Get the query to apply across all variants: looks at all subsites, translat...
Manually create source records for the report. Agreggates cannot be provided as a column of a DataQuery result. {@inheritDoc}
[ "Manually", "create", "source", "records", "for", "the", "report", ".", "Agreggates", "cannot", "be", "provided", "as", "a", "column", "of", "a", "DataQuery", "result", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/Report/CwpStatsReport.php#L50-L109
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolder.php
DatedUpdateHolder.Updates
public function Updates($tagID = null, $dateFrom = null, $dateTo = null, $year = null, $monthNumber = null) { $className = Config::inst()->get($this->ClassName, 'update_class'); return static::AllUpdates($className, $this->ID, $tagID, $dateFrom, $dateTo, $year, $monthNumber); }
php
public function Updates($tagID = null, $dateFrom = null, $dateTo = null, $year = null, $monthNumber = null) { $className = Config::inst()->get($this->ClassName, 'update_class'); return static::AllUpdates($className, $this->ID, $tagID, $dateFrom, $dateTo, $year, $monthNumber); }
[ "public", "function", "Updates", "(", "$", "tagID", "=", "null", ",", "$", "dateFrom", "=", "null", ",", "$", "dateTo", "=", "null", ",", "$", "year", "=", "null", ",", "$", "monthNumber", "=", "null", ")", "{", "$", "className", "=", "Config", "::...
Wrapper to find all updates belonging to this holder, based on some filters.
[ "Wrapper", "to", "find", "all", "updates", "belonging", "to", "this", "holder", "based", "on", "some", "filters", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolder.php#L64-L68
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolder.php
DatedUpdateHolder.AllUpdates
public static function AllUpdates( $className = DatedUpdatePage::class, $parentID = null, $tagID = null, $dateFrom = null, $dateTo = null, $year = null, $monthNumber = null ) { $items = $className::get(); $dbTableName = DataObject::getSchema()->tableForField($className, 'Date'); if (!$dbTableName) { $dbTableName = DatedUpdatePage::class; } // Filter by parent holder. if (isset($parentID)) { $items = $items->filter(['ParentID'=>$parentID]); } // Filter down to a single tag. if (isset($tagID)) { $taxonomy = DataObject::getSchema()->tableName(TaxonomyTerm::class); $tableName = DataObject::getSchema()->tableName($className); $items = $items->innerJoin( 'BasePage_Terms', sprintf('"%s"."ID" = "BasePage_Terms"."BasePageID"', $tableName) )->innerJoin( $taxonomy, sprintf( '"BasePage_Terms"."TaxonomyTermID" = "%s"."ID" AND "TaxonomyTerm"."ID" = \'%d\'', $taxonomy, $tagID ) ); } // Filter by date if (isset($dateFrom)) { if (!isset($dateTo)) { $dateTo = $dateFrom; } $items = $items->where([ sprintf('"%s"."Date" >= \'%s\'', $dbTableName, Convert::raw2sql("$dateFrom 00:00:00")), sprintf('"%s"."Date" <= \'%s\'', $dbTableName, Convert::raw2sql("$dateTo 23:59:59")) ]); } // Filter down to single month. if (isset($year) && isset($monthNumber)) { $year = (int)$year; $monthNumber = (int)$monthNumber; $beginDate = sprintf("%04d-%02d-01 00:00:00", $year, $monthNumber); $endDate = date('Y-m-d H:i:s', strtotime("{$beginDate} +1 month")); $items = $items->where(array( sprintf('"%s"."Date" >= \'%s\'', $dbTableName, Convert::raw2sql($beginDate)), sprintf('"%s"."Date" < \'%s\'', $dbTableName, Convert::raw2sql($endDate)) )); } // Unpaginated DataList. return $items; }
php
public static function AllUpdates( $className = DatedUpdatePage::class, $parentID = null, $tagID = null, $dateFrom = null, $dateTo = null, $year = null, $monthNumber = null ) { $items = $className::get(); $dbTableName = DataObject::getSchema()->tableForField($className, 'Date'); if (!$dbTableName) { $dbTableName = DatedUpdatePage::class; } // Filter by parent holder. if (isset($parentID)) { $items = $items->filter(['ParentID'=>$parentID]); } // Filter down to a single tag. if (isset($tagID)) { $taxonomy = DataObject::getSchema()->tableName(TaxonomyTerm::class); $tableName = DataObject::getSchema()->tableName($className); $items = $items->innerJoin( 'BasePage_Terms', sprintf('"%s"."ID" = "BasePage_Terms"."BasePageID"', $tableName) )->innerJoin( $taxonomy, sprintf( '"BasePage_Terms"."TaxonomyTermID" = "%s"."ID" AND "TaxonomyTerm"."ID" = \'%d\'', $taxonomy, $tagID ) ); } // Filter by date if (isset($dateFrom)) { if (!isset($dateTo)) { $dateTo = $dateFrom; } $items = $items->where([ sprintf('"%s"."Date" >= \'%s\'', $dbTableName, Convert::raw2sql("$dateFrom 00:00:00")), sprintf('"%s"."Date" <= \'%s\'', $dbTableName, Convert::raw2sql("$dateTo 23:59:59")) ]); } // Filter down to single month. if (isset($year) && isset($monthNumber)) { $year = (int)$year; $monthNumber = (int)$monthNumber; $beginDate = sprintf("%04d-%02d-01 00:00:00", $year, $monthNumber); $endDate = date('Y-m-d H:i:s', strtotime("{$beginDate} +1 month")); $items = $items->where(array( sprintf('"%s"."Date" >= \'%s\'', $dbTableName, Convert::raw2sql($beginDate)), sprintf('"%s"."Date" < \'%s\'', $dbTableName, Convert::raw2sql($endDate)) )); } // Unpaginated DataList. return $items; }
[ "public", "static", "function", "AllUpdates", "(", "$", "className", "=", "DatedUpdatePage", "::", "class", ",", "$", "parentID", "=", "null", ",", "$", "tagID", "=", "null", ",", "$", "dateFrom", "=", "null", ",", "$", "dateTo", "=", "null", ",", "$",...
Find all site's updates, based on some filters. Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. @param string $className The name of the class to fetch. @param int|null $parentID The ID of the holder to extract the updates from. @param int|null $tagID The ID of the tag to filter the updates by. @param string|null $dateFrom The beginning of a date filter range. @param string|null $dateTo The end of the date filter range. If empty, only one day will be searched for. @param int|null $year Numeric value of the year to show. @param int|null $monthNumber Numeric value of the month to show. @returns DataList | PaginatedList
[ "Find", "all", "site", "s", "updates", "based", "on", "some", "filters", ".", "Omitting", "parameters", "will", "prevent", "relevant", "filters", "from", "being", "applied", ".", "The", "filters", "are", "ANDed", "together", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolder.php#L84-L151
train
silverstripe/cwp
src/PageTypes/DatedUpdateHolder.php
DatedUpdateHolder.ExtractMonths
public static function ExtractMonths( DataList $updates, $link = null, $currentYear = null, $currentMonthNumber = null ) { // Set the link to current URL in the same way the HTTP::setGetVar does it. if (!isset($link)) { $link = Director::makeRelative($_SERVER['REQUEST_URI']); } $dates = $updates->dataQuery() ->groupby('YEAR("Date")') ->groupby('MONTH("Date")') ->query() ->setSelect([ 'Year' => 'YEAR("Date")', 'Month' => 'MONTH("Date")', ]) ->addWhere('"Date" IS NOT NULL') ->setOrderBy([ 'YEAR("Date")' => 'DESC', 'MONTH("Date")' => 'DESC', ]) ->execute(); $years = []; foreach ($dates as $date) { $monthNumber = $date['Month']; $year = $date['Year']; $dateObj = new DateTime(implode('-', [$year, $monthNumber, 1])); $monthName = $dateObj->Format('M'); // Set up the relevant year array, if not yet available. if (!isset($years[$year])) { $years[$year] = ['YearName'=>$year, 'Months' => []]; } // Check if the currently processed month is the one that is selected via GET params. $active = false; if (isset($year) && isset($monthNumber)) { $active = (((int)$currentYear)==$year && ((int)$currentMonthNumber)==$monthNumber); } // Build the link - keep the tag and date filter, but reset the pagination. if ($active) { // Allow clicking to deselect the month. $link = HTTP::setGetVar('month', null, $link, '&'); $link = HTTP::setGetVar('year', null, $link, '&'); } else { $link = HTTP::setGetVar('month', $monthNumber, $link, '&'); $link = HTTP::setGetVar('year', $year, $link, '&'); } $link = HTTP::setGetVar('start', null, $link, '&'); $years[$year]['Months'][$monthNumber] = array( 'MonthName'=>$monthName, 'MonthNumber'=>$monthNumber, 'MonthLink'=>$link, 'Active'=>$active ); } // ArrayList will not recursively walk through the supplied array, so manually build nested ArrayLists. foreach ($years as &$year) { $year['Months'] = new ArrayList($year['Months']); } // Reverse the list so the most recent years appear first. return new ArrayList($years); }
php
public static function ExtractMonths( DataList $updates, $link = null, $currentYear = null, $currentMonthNumber = null ) { // Set the link to current URL in the same way the HTTP::setGetVar does it. if (!isset($link)) { $link = Director::makeRelative($_SERVER['REQUEST_URI']); } $dates = $updates->dataQuery() ->groupby('YEAR("Date")') ->groupby('MONTH("Date")') ->query() ->setSelect([ 'Year' => 'YEAR("Date")', 'Month' => 'MONTH("Date")', ]) ->addWhere('"Date" IS NOT NULL') ->setOrderBy([ 'YEAR("Date")' => 'DESC', 'MONTH("Date")' => 'DESC', ]) ->execute(); $years = []; foreach ($dates as $date) { $monthNumber = $date['Month']; $year = $date['Year']; $dateObj = new DateTime(implode('-', [$year, $monthNumber, 1])); $monthName = $dateObj->Format('M'); // Set up the relevant year array, if not yet available. if (!isset($years[$year])) { $years[$year] = ['YearName'=>$year, 'Months' => []]; } // Check if the currently processed month is the one that is selected via GET params. $active = false; if (isset($year) && isset($monthNumber)) { $active = (((int)$currentYear)==$year && ((int)$currentMonthNumber)==$monthNumber); } // Build the link - keep the tag and date filter, but reset the pagination. if ($active) { // Allow clicking to deselect the month. $link = HTTP::setGetVar('month', null, $link, '&'); $link = HTTP::setGetVar('year', null, $link, '&'); } else { $link = HTTP::setGetVar('month', $monthNumber, $link, '&'); $link = HTTP::setGetVar('year', $year, $link, '&'); } $link = HTTP::setGetVar('start', null, $link, '&'); $years[$year]['Months'][$monthNumber] = array( 'MonthName'=>$monthName, 'MonthNumber'=>$monthNumber, 'MonthLink'=>$link, 'Active'=>$active ); } // ArrayList will not recursively walk through the supplied array, so manually build nested ArrayLists. foreach ($years as &$year) { $year['Months'] = new ArrayList($year['Months']); } // Reverse the list so the most recent years appear first. return new ArrayList($years); }
[ "public", "static", "function", "ExtractMonths", "(", "DataList", "$", "updates", ",", "$", "link", "=", "null", ",", "$", "currentYear", "=", "null", ",", "$", "currentMonthNumber", "=", "null", ")", "{", "// Set the link to current URL in the same way the HTTP::se...
Produce an ArrayList of available months out of the updates contained in the DataList. Here is an example of the returned structure: ArrayList: ArrayData: YearName => 2013 Months => ArrayList: MonthName => Jan MonthNumber => 1 MonthLink => (page URL)year=2012&month=1 Active => true ArrayData: YearName => 2012 Months => ArrayList: ... @param DataList $updates DataList DataList to extract months from. @param string $link Link used as abase to construct the MonthLink. @param int $currentYear Currently selected year, for computing the link active state. @param int $currentMonthNumber Currently selected month, for computing the link active state. @returns ArrayList
[ "Produce", "an", "ArrayList", "of", "available", "months", "out", "of", "the", "updates", "contained", "in", "the", "DataList", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/DatedUpdateHolder.php#L177-L247
train
silverstripe/cwp
src/PageTypes/EventHolderController.php
EventHolderController.FilteredUpdates
public function FilteredUpdates($pageSize = 20) { $params = $this->parseParams(); $items = $this->Updates( $params['tag'], $params['from'], $params['to'], $params['year'], $params['month'] ); if ($params['upcomingOnly']) { $items = $items->filter(['Date:LessThan:Not' => DBDatetime::now()->Format('y-MM-dd')]); } // Apply pagination $list = PaginatedList::create($items, $this->getRequest()); $list->setPageLength($pageSize); return $list; }
php
public function FilteredUpdates($pageSize = 20) { $params = $this->parseParams(); $items = $this->Updates( $params['tag'], $params['from'], $params['to'], $params['year'], $params['month'] ); if ($params['upcomingOnly']) { $items = $items->filter(['Date:LessThan:Not' => DBDatetime::now()->Format('y-MM-dd')]); } // Apply pagination $list = PaginatedList::create($items, $this->getRequest()); $list->setPageLength($pageSize); return $list; }
[ "public", "function", "FilteredUpdates", "(", "$", "pageSize", "=", "20", ")", "{", "$", "params", "=", "$", "this", "->", "parseParams", "(", ")", ";", "$", "items", "=", "$", "this", "->", "Updates", "(", "$", "params", "[", "'tag'", "]", ",", "$...
Get the events based on the current query.
[ "Get", "the", "events", "based", "on", "the", "current", "query", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/EventHolderController.php#L50-L70
train
silverstripe/cwp
src/Extensions/CwpSiteTreeFileExtension.php
CwpSiteTreeFileExtension.BackLinkHTMLList
public function BackLinkHTMLList() { $html = '<em>' . _t( __CLASS__ . '.BACKLINK_LIST_DESCRIPTION', 'This list shows all pages where the file has been added through a WYSIWYG editor.' ) . '</em>'; $html .= '<ul>'; foreach ($this->owner->BackLinkTracking() as $backLink) { $listItem = '<li>'; // Add the page link $listItem .= '<a href="' . $backLink->Link() . '" target="_blank">' . Convert::raw2xml($backLink->MenuTitle) . '</a> &ndash; '; // Add the CMS link $listItem .= '<a href="' . $backLink->CMSEditLink() . '">' . _t(__CLASS__ . '.EDIT', 'Edit') . '</a>'; $html .= $listItem . '</li>'; } $html .= '</ul>'; return $html; }
php
public function BackLinkHTMLList() { $html = '<em>' . _t( __CLASS__ . '.BACKLINK_LIST_DESCRIPTION', 'This list shows all pages where the file has been added through a WYSIWYG editor.' ) . '</em>'; $html .= '<ul>'; foreach ($this->owner->BackLinkTracking() as $backLink) { $listItem = '<li>'; // Add the page link $listItem .= '<a href="' . $backLink->Link() . '" target="_blank">' . Convert::raw2xml($backLink->MenuTitle) . '</a> &ndash; '; // Add the CMS link $listItem .= '<a href="' . $backLink->CMSEditLink() . '">' . _t(__CLASS__ . '.EDIT', 'Edit') . '</a>'; $html .= $listItem . '</li>'; } $html .= '</ul>'; return $html; }
[ "public", "function", "BackLinkHTMLList", "(", ")", "{", "$", "html", "=", "'<em>'", ".", "_t", "(", "__CLASS__", ".", "'.BACKLINK_LIST_DESCRIPTION'", ",", "'This list shows all pages where the file has been added through a WYSIWYG editor.'", ")", ".", "'</em>'", ";", "$"...
Generate an HTML list which provides links to where a file is used. @return string
[ "Generate", "an", "HTML", "list", "which", "provides", "links", "to", "where", "a", "file", "is", "used", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/Extensions/CwpSiteTreeFileExtension.php#L37-L62
train
silverstripe/cwp
src/PageTypes/FooterHolder.php
FooterHolder.redirectionLink
public function redirectionLink() { $childPage = $this->Children()->first(); if ($childPage) { // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of // redirector pages from causing an infinite loop. Instead, they will cause a 30x redirection loop in // the browser, but this can be handled sufficiently gracefully by the browser. if ($childPage instanceof RedirectorPage) { return $childPage->regularLink(); } // For all other pages, just return the link of the page. return $childPage->Link(); } }
php
public function redirectionLink() { $childPage = $this->Children()->first(); if ($childPage) { // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of // redirector pages from causing an infinite loop. Instead, they will cause a 30x redirection loop in // the browser, but this can be handled sufficiently gracefully by the browser. if ($childPage instanceof RedirectorPage) { return $childPage->regularLink(); } // For all other pages, just return the link of the page. return $childPage->Link(); } }
[ "public", "function", "redirectionLink", "(", ")", "{", "$", "childPage", "=", "$", "this", "->", "Children", "(", ")", "->", "first", "(", ")", ";", "if", "(", "$", "childPage", ")", "{", "// If we're linking to another redirectorpage then just return the URLSegm...
Return the link to the first child page.
[ "Return", "the", "link", "to", "the", "first", "child", "page", "." ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/PageTypes/FooterHolder.php#L44-L58
train
silverstripe/cwp
src/Extensions/CwpSiteTreeExtension.php
CwpSiteTreeExtension.updateSettingsFields
public function updateSettingsFields(FieldList $fields) { $helpText = _t( __CLASS__ . '.SHOW_PAGE_UTILITIES_HELP', 'You can disable page utilities (print, share, etc) for this page' ); $fields->addFieldsToTab( 'Root.Settings', array( LiteralField::create('PageUtilitiesHelp', $helpText), CheckboxField::create('ShowPageUtilities', $this->owner->fieldLabel('ShowPageUtilities')) ) ); }
php
public function updateSettingsFields(FieldList $fields) { $helpText = _t( __CLASS__ . '.SHOW_PAGE_UTILITIES_HELP', 'You can disable page utilities (print, share, etc) for this page' ); $fields->addFieldsToTab( 'Root.Settings', array( LiteralField::create('PageUtilitiesHelp', $helpText), CheckboxField::create('ShowPageUtilities', $this->owner->fieldLabel('ShowPageUtilities')) ) ); }
[ "public", "function", "updateSettingsFields", "(", "FieldList", "$", "fields", ")", "{", "$", "helpText", "=", "_t", "(", "__CLASS__", ".", "'.SHOW_PAGE_UTILITIES_HELP'", ",", "'You can disable page utilities (print, share, etc) for this page'", ")", ";", "$", "fields", ...
Modify the settings for a SiteTree {@inheritDoc} @param FieldList $fields
[ "Modify", "the", "settings", "for", "a", "SiteTree" ]
0f78324d8eac18f1766bc519651a4aa175df13a0
https://github.com/silverstripe/cwp/blob/0f78324d8eac18f1766bc519651a4aa175df13a0/src/Extensions/CwpSiteTreeExtension.php#L27-L41
train
soberwp/controller
src/Loader.php
Loader.setClassesToRun
protected function setClassesToRun() { foreach ($this->listOfFiles as $filename => $file) { // Exclude non-PHP files if (!Utils::isFilePhp($filename)) { continue; } // Exclude non-Controller classes if (!Utils::doesFileContain($filename, 'extends Controller')) { continue; } // Set the classes to run $this->classesToRun[] = $this->namespace . '\\' . pathinfo($filename, PATHINFO_FILENAME); } }
php
protected function setClassesToRun() { foreach ($this->listOfFiles as $filename => $file) { // Exclude non-PHP files if (!Utils::isFilePhp($filename)) { continue; } // Exclude non-Controller classes if (!Utils::doesFileContain($filename, 'extends Controller')) { continue; } // Set the classes to run $this->classesToRun[] = $this->namespace . '\\' . pathinfo($filename, PATHINFO_FILENAME); } }
[ "protected", "function", "setClassesToRun", "(", ")", "{", "foreach", "(", "$", "this", "->", "listOfFiles", "as", "$", "filename", "=>", "$", "file", ")", "{", "// Exclude non-PHP files", "if", "(", "!", "Utils", "::", "isFilePhp", "(", "$", "filename", "...
Set Class Instances Load each Class instance and store in $instances[]
[ "Set", "Class", "Instances" ]
6b1e77991bfec1242d5d1d03db6f024981680c6e
https://github.com/soberwp/controller/blob/6b1e77991bfec1242d5d1d03db6f024981680c6e/src/Loader.php#L94-L110
train
soberwp/controller
src/Loader.php
Loader.addBodyDataClasses
protected function addBodyDataClasses() { add_filter('body_class', function ($body) { global $wp_query; // Get the template hierarchy from WordPress $templates = $this->hierarchy->getTemplates($wp_query); // Reverse the templates returned from $this->hierarchy $templates = array_reverse($templates); // Add app-data to classes array $classes[] = 'app-data'; foreach ($templates as $template) { // Exclude .blade.php and index.php if (strpos($template, '.blade.php') || $template === 'index.php') { continue; } // Exclude index as we use app if ($template === 'index') { $template = 'index.php'; } // Replace .php with -data and add to the classes array $classes[] = basename(str_replace('.php', '-data', $template)); } // Return the new body class list for WordPress return array_merge($body, $classes); }); }
php
protected function addBodyDataClasses() { add_filter('body_class', function ($body) { global $wp_query; // Get the template hierarchy from WordPress $templates = $this->hierarchy->getTemplates($wp_query); // Reverse the templates returned from $this->hierarchy $templates = array_reverse($templates); // Add app-data to classes array $classes[] = 'app-data'; foreach ($templates as $template) { // Exclude .blade.php and index.php if (strpos($template, '.blade.php') || $template === 'index.php') { continue; } // Exclude index as we use app if ($template === 'index') { $template = 'index.php'; } // Replace .php with -data and add to the classes array $classes[] = basename(str_replace('.php', '-data', $template)); } // Return the new body class list for WordPress return array_merge($body, $classes); }); }
[ "protected", "function", "addBodyDataClasses", "(", ")", "{", "add_filter", "(", "'body_class'", ",", "function", "(", "$", "body", ")", "{", "global", "$", "wp_query", ";", "// Get the template hierarchy from WordPress", "$", "templates", "=", "$", "this", "->", ...
Set Document Classes Set the classes required for the blade filter to pass on data @return array
[ "Set", "Document", "Classes" ]
6b1e77991bfec1242d5d1d03db6f024981680c6e
https://github.com/soberwp/controller/blob/6b1e77991bfec1242d5d1d03db6f024981680c6e/src/Loader.php#L131-L163
train
soberwp/controller
src/Controller.php
Controller.__setData
final public function __setData($incomingData) { $this->incomingData = $incomingData; // Set the data from the WordPress post if singular to $this->data $this->__setDataFromPost(); // Set the data from Advanced Custom Fields to $this->data $this->__setDataFromModuleAcf(); // Set incoming filter data from Sage to App before Debugger $this->__setDataFromFilter(); // Set the public methods from the class to $this->methods $this->__setDataFromMethods(); // Set debugger data first to use only the raw data from the Controller $this->__setBladeData(); // Set app data to $this->data['__app'] or merge with current data $this->__setAppData(); // Set tree data to $this->data['__tree'] or merge with current data $this->__setTreeData(); }
php
final public function __setData($incomingData) { $this->incomingData = $incomingData; // Set the data from the WordPress post if singular to $this->data $this->__setDataFromPost(); // Set the data from Advanced Custom Fields to $this->data $this->__setDataFromModuleAcf(); // Set incoming filter data from Sage to App before Debugger $this->__setDataFromFilter(); // Set the public methods from the class to $this->methods $this->__setDataFromMethods(); // Set debugger data first to use only the raw data from the Controller $this->__setBladeData(); // Set app data to $this->data['__app'] or merge with current data $this->__setAppData(); // Set tree data to $this->data['__tree'] or merge with current data $this->__setTreeData(); }
[ "final", "public", "function", "__setData", "(", "$", "incomingData", ")", "{", "$", "this", "->", "incomingData", "=", "$", "incomingData", ";", "// Set the data from the WordPress post if singular to $this->data", "$", "this", "->", "__setDataFromPost", "(", ")", ";...
Set Controller Data Set the Controller raw data for this Controller @return $this
[ "Set", "Controller", "Data" ]
6b1e77991bfec1242d5d1d03db6f024981680c6e
https://github.com/soberwp/controller/blob/6b1e77991bfec1242d5d1d03db6f024981680c6e/src/Controller.php#L80-L104
train
soberwp/controller
src/Controller.php
Controller.__setDataFromPost
final private function __setDataFromPost() { // Only set data from $post to App class if ($this->template !== 'app') { return; } // Only continue if $post is available if (!is_singular()) { return; } // Set $this->post to allow users to use $this->post->post_title and others $this->post = get_post(); // Set the post array to be included in $this->data $this->data['post'] = $this->post; }
php
final private function __setDataFromPost() { // Only set data from $post to App class if ($this->template !== 'app') { return; } // Only continue if $post is available if (!is_singular()) { return; } // Set $this->post to allow users to use $this->post->post_title and others $this->post = get_post(); // Set the post array to be included in $this->data $this->data['post'] = $this->post; }
[ "final", "private", "function", "__setDataFromPost", "(", ")", "{", "// Only set data from $post to App class", "if", "(", "$", "this", "->", "template", "!==", "'app'", ")", "{", "return", ";", "}", "// Only continue if $post is available", "if", "(", "!", "is_sing...
Set Data From Post Set the WordPress post
[ "Set", "Data", "From", "Post" ]
6b1e77991bfec1242d5d1d03db6f024981680c6e
https://github.com/soberwp/controller/blob/6b1e77991bfec1242d5d1d03db6f024981680c6e/src/Controller.php#L111-L128
train
soberwp/controller
src/Controller.php
Controller.__setDatafromModuleAcf
final private function __setDatafromModuleAcf() { // If $this->acf is not set then return if (!$this->acf) { return; } // Set the fields data passed in from Controller $this->classAcf->setData($this->acf); // Get the options page is $this->acf is set to true on App if ($this->template === 'app' && is_bool($this->acf)) { $this->classAcf->setDataOptionsPage(); } // Deterime if acf/array filter is enabled and return correct format $this->classAcf->setDataReturnFormat(); // If there is no data return if (!$this->classAcf->getData()) { return; } // Merge the data from Acf module $this->data = array_merge($this->data, $this->classAcf->getData()); }
php
final private function __setDatafromModuleAcf() { // If $this->acf is not set then return if (!$this->acf) { return; } // Set the fields data passed in from Controller $this->classAcf->setData($this->acf); // Get the options page is $this->acf is set to true on App if ($this->template === 'app' && is_bool($this->acf)) { $this->classAcf->setDataOptionsPage(); } // Deterime if acf/array filter is enabled and return correct format $this->classAcf->setDataReturnFormat(); // If there is no data return if (!$this->classAcf->getData()) { return; } // Merge the data from Acf module $this->data = array_merge($this->data, $this->classAcf->getData()); }
[ "final", "private", "function", "__setDatafromModuleAcf", "(", ")", "{", "// If $this->acf is not set then return", "if", "(", "!", "$", "this", "->", "acf", ")", "{", "return", ";", "}", "// Set the fields data passed in from Controller", "$", "this", "->", "classAcf...
Set Data From Module Acf Set the Advanced Custom Fields data automatically
[ "Set", "Data", "From", "Module", "Acf" ]
6b1e77991bfec1242d5d1d03db6f024981680c6e
https://github.com/soberwp/controller/blob/6b1e77991bfec1242d5d1d03db6f024981680c6e/src/Controller.php#L135-L160
train
soberwp/controller
src/Controller.php
Controller.__setDataFromFilter
final private function __setDataFromFilter() { if ($this->template === 'app') { // Merge all incoming data from app to allow Sage add_filter support $this->data = array_merge($this->data, $this->incomingData); } }
php
final private function __setDataFromFilter() { if ($this->template === 'app') { // Merge all incoming data from app to allow Sage add_filter support $this->data = array_merge($this->data, $this->incomingData); } }
[ "final", "private", "function", "__setDataFromFilter", "(", ")", "{", "if", "(", "$", "this", "->", "template", "===", "'app'", ")", "{", "// Merge all incoming data from app to allow Sage add_filter support", "$", "this", "->", "data", "=", "array_merge", "(", "$",...
Set Sage Filter Data Merge $this->data with $this->incomingData as Sage filters run before -data class filters
[ "Set", "Sage", "Filter", "Data" ]
6b1e77991bfec1242d5d1d03db6f024981680c6e
https://github.com/soberwp/controller/blob/6b1e77991bfec1242d5d1d03db6f024981680c6e/src/Controller.php#L167-L173
train
soberwp/controller
src/Controller.php
Controller.__setBladeData
final private function __setBladeData() { // Get the data $debuggerData = $this->data; // Loop through each data method foreach ($this->dataMethods as $dataMethod) { // Convert the key to snake case to find in $debuggerData $key = Utils::convertToSnakeCase($dataMethod->name); // Save the returned value from the above key $returned = $debuggerData[$key]; // Recreate the key with the method included $debuggerData[$key] = (object) [ 'method' => $dataMethod, 'returned' => $returned ]; } // Create the final debugger object $debugger = (object) [ 'class' => $this->class->getShortName(), 'tree' => $this->tree, 'methods' => $this->staticMethods, 'data' => $debuggerData ]; // Include current debugger data in existing debugger array $this->incomingData['__blade'][] = $debugger; // Set the updated array to $this->data for @debug use $this->data['__blade'] = $this->incomingData['__blade']; }
php
final private function __setBladeData() { // Get the data $debuggerData = $this->data; // Loop through each data method foreach ($this->dataMethods as $dataMethod) { // Convert the key to snake case to find in $debuggerData $key = Utils::convertToSnakeCase($dataMethod->name); // Save the returned value from the above key $returned = $debuggerData[$key]; // Recreate the key with the method included $debuggerData[$key] = (object) [ 'method' => $dataMethod, 'returned' => $returned ]; } // Create the final debugger object $debugger = (object) [ 'class' => $this->class->getShortName(), 'tree' => $this->tree, 'methods' => $this->staticMethods, 'data' => $debuggerData ]; // Include current debugger data in existing debugger array $this->incomingData['__blade'][] = $debugger; // Set the updated array to $this->data for @debug use $this->data['__blade'] = $this->incomingData['__blade']; }
[ "final", "private", "function", "__setBladeData", "(", ")", "{", "// Get the data", "$", "debuggerData", "=", "$", "this", "->", "data", ";", "// Loop through each data method", "foreach", "(", "$", "this", "->", "dataMethods", "as", "$", "dataMethod", ")", "{",...
Set Blade Data Update $this->data with __blade
[ "Set", "Blade", "Data" ]
6b1e77991bfec1242d5d1d03db6f024981680c6e
https://github.com/soberwp/controller/blob/6b1e77991bfec1242d5d1d03db6f024981680c6e/src/Controller.php#L220-L253
train
soberwp/controller
src/Controller.php
Controller.__setAppData
final private function __setAppData() { if ($this->template === 'app') { // Save the app data in $this->data['__app'] $this->data['__app'] = $this->data; // Esc the function return; } // Save the app data to this $this->data['__app'] for next Controller $this->data['__app'] = $this->incomingData['__app']; // Include the app data with this current items data $this->data = array_merge($this->data['__app'], $this->data); }
php
final private function __setAppData() { if ($this->template === 'app') { // Save the app data in $this->data['__app'] $this->data['__app'] = $this->data; // Esc the function return; } // Save the app data to this $this->data['__app'] for next Controller $this->data['__app'] = $this->incomingData['__app']; // Include the app data with this current items data $this->data = array_merge($this->data['__app'], $this->data); }
[ "final", "private", "function", "__setAppData", "(", ")", "{", "if", "(", "$", "this", "->", "template", "===", "'app'", ")", "{", "// Save the app data in $this->data['__app']", "$", "this", "->", "data", "[", "'__app'", "]", "=", "$", "this", "->", "data",...
Set App Data Update $this->data with __app
[ "Set", "App", "Data" ]
6b1e77991bfec1242d5d1d03db6f024981680c6e
https://github.com/soberwp/controller/blob/6b1e77991bfec1242d5d1d03db6f024981680c6e/src/Controller.php#L260-L274
train
soberwp/controller
src/Controller.php
Controller.__setTreeData
final private function __setTreeData() { if ($this->tree) { // Include existing data with this Controller data $this->data = array_merge($this->incomingData['__store'], $this->data); } // Save updated data to $this->data['__store'] for next Controller $this->data['__store'] = array_merge($this->incomingData, $this->data); }
php
final private function __setTreeData() { if ($this->tree) { // Include existing data with this Controller data $this->data = array_merge($this->incomingData['__store'], $this->data); } // Save updated data to $this->data['__store'] for next Controller $this->data['__store'] = array_merge($this->incomingData, $this->data); }
[ "final", "private", "function", "__setTreeData", "(", ")", "{", "if", "(", "$", "this", "->", "tree", ")", "{", "// Include existing data with this Controller data", "$", "this", "->", "data", "=", "array_merge", "(", "$", "this", "->", "incomingData", "[", "'...
Set Tree Data Update $this->data with tree data if required and store existing data
[ "Set", "Tree", "Data" ]
6b1e77991bfec1242d5d1d03db6f024981680c6e
https://github.com/soberwp/controller/blob/6b1e77991bfec1242d5d1d03db6f024981680c6e/src/Controller.php#L281-L290
train