← All changes
|
admin/views/sp-framework/classes/fields.class.php
+4
-41
2.4.14
→
2.2.10
View file →
| @@ -17,14 +17,8 @@ | ||
| 17 | 17 | $this->where = $where; |
| 18 | 18 | $this->parent = $parent; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - /** | |
| 22 | - * Field name method. | |
| 23 | - * | |
| 24 | - * @param string $nested_name Nested field name. | |
| 25 | - * @return string | |
| 26 | - */ | |
| 27 | 21 | public function field_name( $nested_name = '' ) { |
| 28 | 22 | |
| 29 | 23 | $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : ''; |
| 30 | 24 | $unique_id = ( ! empty( $this->unique ) ) ? $this->unique . '[' . $field_id . ']' : $field_id; |
| @@ -38,14 +32,8 @@ | ||
| 38 | 32 | return $field_name . $nested_name; |
| 39 | 33 | |
| 40 | 34 | } |
| 41 | 35 | |
| 42 | - /** | |
| 43 | - * Field attributes. | |
| 44 | - * | |
| 45 | - * @param array $custom_atts Custom attributes. | |
| 46 | - * @return mixed | |
| 47 | - */ | |
| 48 | 36 | public function field_attributes( $custom_atts = array() ) { |
| 49 | 37 | |
| 50 | 38 | $field_id = ( ! empty( $this->field['id'] ) ) ? $this->field['id'] : ''; |
| 51 | 39 | $attributes = ( ! empty( $this->field['attributes'] ) ) ? $this->field['attributes'] : array(); |
| @@ -63,9 +51,9 @@ | ||
| 63 | 51 | $atts = ''; |
| 64 | 52 | |
| 65 | 53 | if ( ! empty( $attributes ) ) { |
| 66 | 54 | foreach ( $attributes as $key => $value ) { |
| 67 | - if ( 'only-key' === $value ) { | |
| 55 | + if ( $value === 'only-key' ) { | |
| 68 | 56 | $atts .= ' ' . $key; |
| 69 | 57 | } else { |
| 70 | 58 | $atts .= ' ' . $key . '="' . $value . '"'; |
| 71 | 59 | } |
| @@ -75,22 +63,12 @@ | ||
| 75 | 63 | return $atts; |
| 76 | 64 | |
| 77 | 65 | } |
| 78 | 66 | |
| 79 | - /** | |
| 80 | - * Field before. | |
| 81 | - * | |
| 82 | - * @return mixed | |
| 83 | - */ | |
| 84 | 67 | public function field_before() { |
| 85 | 68 | return ( ! empty( $this->field['before'] ) ) ? $this->field['before'] : ''; |
| 86 | 69 | } |
| 87 | 70 | |
| 88 | - /** | |
| 89 | - * Field after. | |
| 90 | - * | |
| 91 | - * @return mixed | |
| 92 | - */ | |
| 93 | 71 | public function field_after() { |
| 94 | 72 | |
| 95 | 73 | $output = ( ! empty( $this->field['after'] ) ) ? $this->field['after'] : ''; |
| 96 | 74 | $output .= ( ! empty( $this->field['desc'] ) ) ? '<p class="spf-text-desc">' . $this->field['desc'] . '</p>' : ''; |
| @@ -106,11 +84,10 @@ | ||
| 106 | 84 | * |
| 107 | 85 | * @param array $type post types. |
| 108 | 86 | * @param boolean $term post term. |
| 109 | 87 | * @param array $query_args post term. |
| 110 | - * @param array $field_unique unique id. | |
| 111 | 88 | * |
| 112 | - * @return array | |
| 89 | + * @return statement | |
| 113 | 90 | */ |
| 114 | 91 | public static function field_data( $type = '', $term = false, $query_args = array(), $field_unique = null ) { |
| 115 | 92 | |
| 116 | 93 | $options = array(); |
| @@ -169,23 +146,9 @@ | ||
| 169 | 146 | } |
| 170 | 147 | } |
| 171 | 148 | |
| 172 | 149 | break; |
| 173 | - case 'sp_post_carousel': | |
| 174 | - $pcp_get_specific = array( | |
| 175 | - 'post_type' => 'sp_post_carousel', | |
| 176 | - ); | |
| 177 | - $query_args = array_merge( $query_args, $pcp_get_specific ); | |
| 178 | - $all_posts = get_posts( $query_args ); | |
| 179 | 150 | |
| 180 | - if ( ! is_wp_error( $all_posts ) && ! empty( $all_posts ) ) { | |
| 181 | - foreach ( $all_posts as $post_obj ) { | |
| 182 | - $options[ $post_obj->ID ] = isset( $post_obj->post_title ) && ! empty( $post_obj->post_title ) ? $post_obj->post_title : 'Untitled'; | |
| 183 | - } | |
| 184 | - } | |
| 185 | - wp_reset_postdata(); | |
| 186 | - break; | |
| 187 | - | |
| 188 | 151 | case 'category': |
| 189 | 152 | case 'categories': |
| 190 | 153 | case 'tag': |
| 191 | 154 | case 'tags': |
| @@ -277,9 +240,9 @@ | ||
| 277 | 240 | $view_options = get_post_meta( $post->ID, 'sp_pcp_view_options', true ); |
| 278 | 241 | $pcp_post_types = isset( $view_options['pcp_select_post_type'] ) && ! empty( $view_options['pcp_select_post_type'] ) ? $view_options['pcp_select_post_type'] : 'post'; |
| 279 | 242 | $taxonomy_names = get_object_taxonomies( $pcp_post_types, 'names' ); |
| 280 | 243 | if ( ! is_wp_error( $taxonomy_names ) && ! empty( $taxonomy_names ) ) { |
| 281 | - $options[''] = __( 'Select Taxonomy', 'post-carousel' ); | |
| 244 | + $options[''] = __( 'Select Taxonomy', 'smart-post-show' ); | |
| 282 | 245 | foreach ( $taxonomy_names as $taxonomy => $label ) { |
| 283 | 246 | $options[ $label ] = $label; |
| 284 | 247 | } |
| 285 | 248 | } |
| @@ -290,9 +253,9 @@ | ||
| 290 | 253 | global $post; |
| 291 | 254 | $view_options = get_post_meta( $post->ID, 'sp_pcp_view_options', true ); |
| 292 | 255 | $pcp_post_types = isset( $view_options['pcp_select_post_type'] ) && ! empty( $view_options['pcp_select_post_type'] ) ? $view_options['pcp_select_post_type'] : get_post_types( array(), 'names' ); |
| 293 | 256 | |
| 294 | - $field_index = preg_replace( '/[^0-9]/', '', $field_unique ); | |
| 257 | + $field_index = preg_replace( '/[^0-9]/', '', $field_unique ); | |
| 295 | 258 | $pcp_taxonomy = isset( $view_options['pcp_filter_by_taxonomy']['pcp_taxonomy_and_terms'][ $field_index ]['pcp_select_taxonomy'] ) ? $view_options['pcp_filter_by_taxonomy']['pcp_taxonomy_and_terms'][ $field_index ]['pcp_select_taxonomy'] : get_object_taxonomies( $pcp_post_types, 'names' ); |
| 296 | 259 | if ( version_compare( get_bloginfo( 'version' ), '4.5', '>=' ) ) { |
| 297 | 260 | $terms = get_terms( array( 'taxonomy' => $pcp_taxonomy ) ); |
| 298 | 261 | } else { |