Changeset 2837947
- Timestamp:
- 12/22/2022 12:15:12 PM (3 years ago)
- Location:
- panda-pods-repeater-field
- Files:
-
- 3 deleted
- 8 edited
- 8 copied
- 1 moved
-
tags/1.5.4 (copied) (copied from panda-pods-repeater-field/trunk)
-
tags/1.5.4/README.txt (copied) (copied from panda-pods-repeater-field/trunk/README.txt)
-
tags/1.5.4/classes/podsfield_pandarepeaterfield.php (moved) (moved from panda-pods-repeater-field/trunk/classes/podsfield_pandarepeaterfield.php)
-
tags/1.5.4/fields/pandarepeaterfield.php (copied) (copied from panda-pods-repeater-field/trunk/fields/pandarepeaterfield.php)
-
tags/1.5.4/js/admin.js (copied) (copied from panda-pods-repeater-field/trunk/js/admin.js)
-
tags/1.5.4/js/admin.js.map (copied) (copied from panda-pods-repeater-field/trunk/js/admin.js.map)
-
tags/1.5.4/js/admin.min.js (copied) (copied from panda-pods-repeater-field/trunk/js/admin.min.js)
-
tags/1.5.4/js/admin.min.js.map (copied) (copied from panda-pods-repeater-field/trunk/js/admin.min.js.map)
-
tags/1.5.4/panda-pods-repeater-field.php (copied) (copied from panda-pods-repeater-field/trunk/panda-pods-repeater-field.php)
-
trunk/README.txt (modified) (7 diffs)
-
trunk/classes/panda_pods_repeater_field_ajax.php (deleted)
-
trunk/classes/panda_pods_repeater_field_db.php (deleted)
-
trunk/fields/index.php (modified) (1 diff)
-
trunk/fields/pandarepeaterfield.php (modified) (11 diffs)
-
trunk/js/admin.js (modified) (32 diffs)
-
trunk/js/admin.js.map (modified) (1 diff)
-
trunk/js/admin.min.js (modified) (1 diff)
-
trunk/js/admin.min.js.map (modified) (1 diff)
-
trunk/library (deleted)
-
trunk/panda-pods-repeater-field.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
panda-pods-repeater-field/trunk/README.txt
r2829601 r2837947 5 5 Requires at least: 3.8 6 6 Tested up to: 6.1.1 7 Stable tag: 1.5. 47 Stable tag: 1.5.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 38 38 From Version 1.1.6, if the field type is "file", it will return the file ids, then use WordPress APIs like get_attached_file(), wp_get_attachment_image_src() etc to get the file details. Relation types of 'user', 'post type', 'pod' and 'media' will now return the saved ID. 39 39 40 You can also use this API to fetch data: pandarf_items_fn( $fields_arr, $attrs, $show Query_bln). Please see the Screenshots section for how to find ids.40 You can also use this API to fetch data: pandarf_items_fn( $fields_arr, $attrs, $show_query ). Please see the Screenshots section for how to find ids. 41 41 42 42 $fields_arr search repeater field table … … 62 62 ) 63 63 64 $show Query_bln64 $show_query 65 65 If set to true, it will print out the sql command. For debugging purpose. Default to false. 66 66 … … 72 72 73 73 = How to insert data at the frontend = 74 You can use this API to insert data: pandarf_insert( $fields_arr, $prf_arr, $show Query_bln). Please see the screenshots for how to find ids.74 You can use this API to insert data: pandarf_insert( $fields_arr, $prf_arr, $show_query ). Please see the screenshots for how to find ids. 75 75 76 76 $fields_arr extra fields other than panda repeater fields to insert: … … 90 90 ) 91 91 92 $show Query_bln92 $show_query 93 93 If set to true, it will print out the sql command. For debugging purpose. Default to false. 94 94 … … 394 394 * fix: Fixed a security issue. 395 395 396 = 1.5.5 - 22th December 2022 = 397 * update: Applied coding standards. 398 396 399 == Upgrade Notice == 397 400 … … 589 592 = 1.5.4 = 590 593 * fix: Fixed a security issue. 594 595 = 1.5.5 = 596 * update: Applied coding standards. -
panda-pods-repeater-field/trunk/fields/index.php
r2617971 r2837947 1 1 <?php 2 include_once('pandarepeaterfield.php'); 2 /** 3 * Default file when the repeater page is loaded. 4 * 5 * @package panda-pods-repeater-field 6 * @author Dongjie Xu 7 * @since 09/02/2016 8 */ 9 10 /** 11 * Index file 12 * 13 * @package panda_pods_repeater_field 14 * @author Dongjie Xu 15 */ 16 17 require_once 'pandarepeaterfield.php'; -
panda-pods-repeater-field/trunk/fields/pandarepeaterfield.php
r2829601 r2837947 1 1 <?php 2 2 /** 3 * field by iframe3 * Field by iframe 4 4 * 5 5 * @package panda-pods-repeater-field 6 6 * @author Dongjie Xu 7 * @since 09/02/2016 7 * @since 09/02/2016 8 8 */ 9 9 10 /** WordPress Administration Bootstrap */ 11 //require_once( '../../../../wp-admin/admin.php' ); 12 //include_once( ABSPATH . 'wp-admin/admin.php' ); 13 define( 'WP_USE_THEMES', false ); // get pass the http_host problem 10 define( 'WP_USE_THEMES', false ); // Get pass the http_host problem. 14 11 15 12 global $current_user, $wpdb; 16 13 17 $is_admin = false; 18 19 if( strpos( $_SERVER['REQUEST_URI'], 'wp-admin') && isset( $_GET['page'] ) && $_GET['page'] == 'panda-pods-repeater-field' ){ // is_admin doesn't work for nested fields 20 $is_admin = true; 21 } else { 14 $is_admin = false; 15 16 if ( isset( $_SERVER['REQUEST_URI'] ) ) { // Is_admin doesn't work for nested fields. 17 $request_uri = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ); 18 if ( false !== strpos( $request_uri, 'wp-admin' ) ) { 19 $is_admin = true; 20 } 21 } 22 if ( false === $is_admin ) { 22 23 require_once dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . '/wp-load.php'; 23 24 wp_head(); 24 25 } 25 if( isset( $_GET ) && count( $_GET ) > 0 ){ 26 foreach( $_GET as $key => $value ){ 27 $_GET[ $key ] = str_replace(array( '(', ')' ), '', esc_attr( $value ) ); 28 } 29 } 30 $_GET = array_map('wp_strip_all_tags', $_GET); 31 32 $int_fields = array( 'itemid', 'podid', 'success', 'postid', 'poditemid' ); 33 foreach( $int_fields as $int_field ){ 34 if( isset( $_GET[ $int_field ] ) ){ 35 $_GET[ $int_field ] = intval( $_GET[ $int_field ] ); 36 } 37 } 26 $security_checked = false; 27 if ( isset( $_GET['pprf_nonce'] ) ) { 28 $pprf_nonce = sanitize_text_field( wp_unslash( $_GET['pprf_nonce'] ) ); 29 if ( wp_verify_nonce( $pprf_nonce, 'load-pprf-page' ) ) { 30 $security_checked = true; 31 } 32 } 33 if ( false === $security_checked ) { 34 die( 'Invalid nonce.' ); 35 } 36 if ( ! isset( $_GET['page'] ) || 'panda-pods-repeater-field' !== sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) { 37 die( 'Not a repeater page.' ); 38 } 39 40 // Sanitize $_GET values. 41 $item_id = isset( $_GET['itemid'] ) ? (int) $_GET['itemid'] : ''; 42 $pod_id = isset( $_GET['podid'] ) ? (int) $_GET['podid'] : ''; 43 $success = isset( $_GET['success'] ) ? (int) $_GET['success'] : ''; 44 $current_post_id = isset( $_GET['postid'] ) ? (int) $_GET['postid'] : ''; 45 $pod_item_id = isset( $_GET['poditemid'] ) ? (int) $_GET['poditemid'] : ''; 46 $pod_table_id = isset( $_GET['tb'] ) ? (int) $_GET['tb'] : ''; 38 47 39 48 $is_allowed = true; 40 49 41 if ( !defined( 'PANDA_PODS_REPEATER_URL' ) || !is_user_logged_in() || !current_user_can('edit_posts') ){42 // action before the iframe50 if ( ! defined( 'PANDA_PODS_REPEATER_URL' ) || ! is_user_logged_in() || ! current_user_can( 'edit_posts' ) ) { 51 // Action before the iframe. 43 52 $is_allowed = false; 44 45 } 46 47 $parent_pod = false; 48 if( isset( $_GET['podid'] ) && is_numeric( $_GET['podid'] ) ){ 49 //$pprf_db = new panda_pods_repeater_field_db(); 50 51 //check it is an Advanced Content Type or normal post type 52 $parent_details = pprf_pod_details( $_GET['podid'] ); 53 54 $parent_pages = 1; 55 $parrent_limit = 20; 56 if( $parent_details ){ 57 $parent_table = $parent_details['post_name'] ; 58 // $conditions = array( 59 // 'limit' => $parrent_limit, 60 // ); 61 //normal post type fetch all published and draft posts 62 if( $parent_details['type'] == 'post_type' ){ 63 64 $conditions['where'] = 't.post_status = "publish" OR t.post_status = "draft"'; 65 66 } 67 $parent_details['pprf_parent'] = intval( $_GET['postid'] ); 68 69 $conditions = pprf_parent_filter_conditions( $parent_details, $parrent_limit ); 70 if( ! empty( $conditions['limit'] ) ){ 71 $parrent_limit = $conditions['limit']; 72 } 73 74 $parent_pod = pods( $parent_table, $conditions ); 75 76 $parents_total = $parent_pod->total_found(); 77 78 $parent_pages = $parent_pod->total_pages(); //ceil( $parent_total / $parrent_limit ); 79 80 if( ! $is_allowed ){ 81 //get current field 82 foreach( $parent_pod->fields as $k => $child_fields ){ 83 if( $child_fields['id'] == $_GET['poditemid'] && $child_fields['type'] == 'pandarepeaterfield' ){ 84 85 if( isset( $child_fields['options']['pandarepeaterfield_public_access'] ) && $child_fields['options']['pandarepeaterfield_public_access'] == 1 ){ // allowed for public access 53 54 } 55 56 $parent_pod = false; 57 if ( isset( $pod_id ) && is_numeric( $pod_id ) ) { 58 59 // Check it is an Advanced Content Type or normal post type. 60 $parent_details = pprf_pod_details( $pod_id ); 61 62 $parent_pages = 1; 63 $parrent_limit = 20; 64 if ( $parent_details ) { 65 $parent_table = $parent_details['post_name']; 66 67 // Normal post type fetch all published and draft posts. 68 if ( 'post_type' === $parent_details['type'] ) { 69 70 $conditions['where'] = 't.post_status = "publish" OR t.post_status = "draft"'; 71 72 } 73 $parent_details['pprf_parent'] = intval( $current_post_id ); 74 75 $conditions = pprf_parent_filter_conditions( $parent_details, $parrent_limit ); 76 if ( ! empty( $conditions['limit'] ) ) { 77 $parrent_limit = $conditions['limit']; 78 } 79 80 $parent_pod = pods( $parent_table, $conditions ); 81 82 $parents_total = $parent_pod->total_found(); 83 84 $parent_pages = $parent_pod->total_pages(); 85 86 if ( ! $is_allowed ) { 87 // Get current field. 88 foreach ( $parent_pod->fields as $k => $child_fields ) { 89 if ( $child_fields['id'] === $pod_item_id && 'pandarepeaterfield' === $child_fields['type'] ) { 90 91 if ( isset( $child_fields['options']['pandarepeaterfield_public_access'] ) && 1 === (int) $child_fields['options']['pandarepeaterfield_public_access'] ) { // Allowed for public access. 86 92 $is_allowed = true; 87 93 } else { 88 // $child_fields['options']['pandarepeaterfield_role_access'] has no value. It is saved into the _postmeta 89 if ( is_user_logged_in() ){90 foreach ( $current_user->roles as $role ){ // the user role can access91 $ok = get_post_meta( $child_fields['id'], $role, true );92 if ( $ok ){94 95 if ( is_user_logged_in() ) { 96 foreach ( $current_user->roles as $role_assigned ) { // The user role can access. 97 $ok = get_post_meta( $child_fields['id'], $role_assigned, true ); 98 if ( $ok ) { 93 99 $is_allowed = true; 94 100 break; 95 101 } 96 } 97 } 98 102 } 103 } 99 104 } 100 105 101 106 break; 102 107 } 103 } 104 } 105 } 106 108 } 109 } 110 } 107 111 } 108 112 109 113 110 114 $is_allowed = apply_filters( 'pprf_load_panda_repeater_allow', $is_allowed, $_GET ); 111 if( !$is_allowed ){ 112 echo '<div class="mg10">'; 113 die( apply_filters( 'pprf_load_panda_repeater_allow_msg', esc_html__('You do not have permission to load this item.', 'panda-pods-repeater-field' ) ) ); 114 echo '</div>'; 115 } 116 117 //include_once( ABSPATH . 'wp-admin/admin-header.php' ); 118 119 120 // 121 //print_r( $_SERVER ); 122 ?> 123 <?php 124 $iframe_id = isset( $_GET['iframe_id'] ) ? esc_attr( $_GET['iframe_id'] ) : ''; 125 $parent_iframe_id = isset( $_GET['piframe_id'] ) ? esc_attr( $_GET['piframe_id'] ) : ''; 126 $wid_int = 25; 127 $wid_str = 'quater'; 128 if( isset( $_GET['poditemid'] ) && is_numeric( $_GET['poditemid'] ) ){ 129 $wid_int = get_post_meta( absint( $_GET['poditemid'] ), 'pandarepeaterfield_field_width' , true); 130 131 } 132 if( !is_numeric( $wid_int ) || $wid_int == 0 ){ 133 $wid_int = 25; 134 } 135 $mgr_int = 0; 136 if( $wid_int != 100 ){ 137 $wid_int = $wid_int - 1; 138 $mgr_int = 1; 115 if ( false === $is_allowed ) { 116 die( 'You do not have permission to load this item.' ); 117 } 118 /** 119 * Validate iframe id 120 * 121 * @param string $iframe_id A iframe id. 122 * 123 * @return boolean If the iframe id is validated. 124 */ 125 function pprf_validate_iframe_id( $iframe_id ) { 126 if ( 'panda-repeater-add-new' === $iframe_id ) { 127 return true; 128 } 129 if ( 0 !== strpos( $iframe_id, 'panda-repeater-add-new-' ) && 0 !== strpos( $iframe_id, 'panda-repeater-edit-' ) ) { 130 return false; 131 } 132 if ( 0 === strpos( $iframe_id, 'panda-repeater-add-new-' ) ) { 133 $parts = explode( '-', str_replace( 'panda-repeater-add-new-', '', $iframe_id ) ); 134 if ( 2 !== count( $parts ) ) { 135 return false; 136 } 137 if ( ! is_numeric( $parts[0] ) || ! is_numeric( $parts[1] ) ) { 138 return false; 139 } 140 } 141 if ( 0 === strpos( $iframe_id, 'panda-repeater-edit-' ) ) { 142 $parts = explode( '-', str_replace( 'panda-repeater-edit-', '', $iframe_id ) ); 143 if ( 3 !== count( $parts ) ) { 144 return false; 145 } 146 if ( ! is_numeric( $parts[0] ) || ! is_numeric( $parts[1] ) || ! is_numeric( $parts[2] ) ) { 147 return false; 148 } 149 } 150 return true; 151 } 152 153 $iframe_id = isset( $_GET['iframe_id'] ) ? sanitize_text_field( wp_unslash( $_GET['iframe_id'] ) ) : ''; 154 155 $iframe_id_valid = pprf_validate_iframe_id( $iframe_id ); 156 if ( false === $iframe_id_valid ) { 157 die( 'Invalid iframe ID.' ); 158 } 159 160 $parent_iframe_id = isset( $_GET['piframe_id'] ) ? sanitize_text_field( wp_unslash( $_GET['piframe_id'] ) ) : ''; 161 if ( '' !== $parent_iframe_id ) { 162 $iframe_id_valid = pprf_validate_iframe_id( $parent_iframe_id ); 163 if ( false === $iframe_id_valid ) { 164 die( 'Invalid parent iframe ID.' ); 165 } 166 } 167 168 $wid_int = 25; 169 $wid_str = 'quater'; 170 if ( is_numeric( $pod_item_id ) ) { 171 $wid_int = get_post_meta( absint( $pod_item_id ), 'pandarepeaterfield_field_width', true ); 172 } 173 if ( ! is_numeric( $wid_int ) || 0 === $wid_int ) { 174 $wid_int = 25; 175 } 176 $mgr_int = 0; 177 if ( 100 !== $wid_int ) { 178 $wid_int = --$wid_int; 179 $mgr_int = 1; 139 180 } else { 140 $wid_str = 'full';141 } 142 if ( $wid_int == 50 ){143 $wid_str = 'half';181 $wid_str = 'full'; 182 } 183 if ( 50 === $wid_int ) { 184 $wid_str = 'half'; 144 185 } 145 186 ?> 146 187 <style> 147 188 html { 148 margin-top: 0px !important;189 margin-top: 0px !important; 149 190 } 150 191 @media (min-width: 992px) { 151 192 .pods-form-fields .pods-field { 152 width: <?php echo esc_html( $wid_int ); ?>%;193 width: <?php echo esc_html( $wid_int ); ?>%; 153 194 margin-right: <?php echo esc_html( $mgr_int ); ?>%; 154 195 } … … 157 198 @media (max-width: 991px) and (min-width: 769px) { 158 199 .pods-form-fields .pods-field { 159 width: <?php echo esc_html( $wid_int ); ?>%;200 width: <?php echo esc_html( $wid_int ); ?>%; 160 201 margin-right: <?php echo esc_html( $mgr_int ); ?>%; 161 202 } … … 166 207 <?php 167 208 echo '<div id="pprf-form" class="pprf-wid-' . esc_attr( $wid_str ) . '">'; 168 $get_data = isset( $_GET )? $_GET : array(); 169 do_action('pandarf_item_top', $get_data ); 170 171 if( isset( $_GET['tb'] ) && is_numeric( $_GET['tb'] ) && array_key_exists( 'pod_' . $_GET['tb'], PodsField_Pandarepeaterfield::$act_tables ) ) { 172 173 $table_name = PodsField_Pandarepeaterfield::$act_tables[ 'pod_' . $_GET['tb'] ]; 174 175 if( isset( $_GET['itemid'] ) && is_numeric( $_GET['itemid'] ) ){ 176 $pod_cla = pods( $table_name, absint( $_GET['itemid'] ) ); 177 } else { 178 $pod_cla = pods( $table_name ); 179 } 180 181 // Output a form with all fields 182 echo $pod_cla->form( array(), 'Save ' . get_the_title( absint( $_GET['poditemid'] ) ) ); 183 184 if( isset( $_GET['itemid'] ) && is_numeric( $_GET['itemid'] ) && isset( $_GET['podid'] ) && is_numeric( $_GET['podid'] ) ) { //&& array_key_exists( 'pod_' . $_GET['podid'], PodsField_Pandarepeaterfield::$act_tables ) 185 186 187 if( $parent_pod ){ 188 189 $reassignable = false; 190 $duplicable = false; 191 //get current field 192 foreach( $parent_pod->fields as $k => $child_fields ){ 193 if( $child_fields['id'] == $_GET['poditemid'] && $child_fields['type'] == 'pandarepeaterfield' ){ 194 $child_table_name = $child_fields['options']['pandarepeaterfield_table']; 195 if( isset( $child_fields['options']['pandarepeaterfield_allow_reassign'] ) && $child_fields['options']['pandarepeaterfield_allow_reassign'] == 1 ){ 196 $reassignable = true; 209 $get_data = isset( $_GET ) ? $_GET : array(); 210 do_action( 'pandarf_item_top', $get_data ); 211 212 if ( '' !== $pod_table_id ) { 213 214 if ( array_key_exists( 'pod_' . $pod_table_id, PodsField_Pandarepeaterfield::$act_tables ) ) { 215 $table_name = PodsField_Pandarepeaterfield::$act_tables[ 'pod_' . $pod_table_id ]; 216 217 if ( isset( $item_id ) && is_numeric( $item_id ) ) { 218 $pod_cla = pods( $table_name, absint( $item_id ) ); 219 } else { 220 $pod_cla = pods( $table_name ); 221 } 222 223 // Output a form with all fields. 224 // phpcs:ignore 225 echo $pod_cla->form( array(), 'Save ' . get_the_title( absint( $pod_item_id ) ) ); 226 227 if ( isset( $item_id ) && is_numeric( $item_id ) && isset( $pod_id ) && is_numeric( $pod_id ) ) { 228 if ( $parent_pod ) { 229 230 $reassignable = false; 231 $duplicable = false; 232 // Get current field. 233 foreach ( $parent_pod->fields as $k => $child_fields ) { 234 if ( $child_fields['id'] === $pod_item_id && 'pandarepeaterfield' === $child_fields['type'] ) { 235 $child_table_name = $child_fields['options']['pandarepeaterfield_table']; 236 if ( isset( $child_fields['options']['pandarepeaterfield_allow_reassign'] ) && 1 === (int) $child_fields['options']['pandarepeaterfield_allow_reassign'] ) { 237 $reassignable = true; 238 } 239 if ( isset( $child_fields['options']['pandarepeaterfield_allow_duplicate'] ) && 1 === (int) $child_fields['options']['pandarepeaterfield_allow_duplicate'] ) { 240 $duplicable = true; 241 } 242 break; 197 243 } 198 if( isset( $child_fields['options']['pandarepeaterfield_allow_duplicate'] ) && $child_fields['options']['pandarepeaterfield_allow_duplicate'] == 1 ){ 199 $duplicable = true; 200 } 201 break; 244 } 245 246 // If reassigning or duplicating is allowed. 247 if ( $reassignable || $duplicable ) { 248 249 $same_child_fields = pprf_same_child_tb_fields( $parent_pod, $child_table_name ); 250 251 $parents_html = ''; 252 253 if ( 0 < $parent_pod->total() ) { 254 $parents_html = '<div class="pprf-left mgt10 mgb15 w100" id="pprf-bottom-wrap">'; 255 if ( $parent_pages > 1 ) { 256 $parents_html .= '<label class="pprf-left"><strong class="mgr10 mgt5">' . esc_html__( 'Load parents: ', 'panda-pods-repeater-field' ) . '</strong>'; 257 $parents_html .= '<select name="pprf_field pprf-left mgt5" id="pprf-field-parent-loader" class="pprf-in-iframe-sel">'; 258 for ( $i = 1; $i <= $parent_pages; $i ++ ) { 259 $max = $parrent_limit * $i; 260 261 if ( $i === $parent_pages && $parents_total < $max ) { 262 $max = $parents_total; 263 } 264 $parents_html .= '<option value="' . $i . '">' . ( $parrent_limit * ( $i - 1 ) + 1 ) . ' - ' . $max . '</option>'; 265 266 } 267 $parents_html .= '</select>'; 268 $parents_html .= '</label>'; 269 } 270 271 $parents_html .= '<label class="pprf-left"><strong class="mgr10 mgt5">' . esc_html__( 'Assign to parent: ', 'panda-pods-repeater-field' ) . '</strong>'; 272 $parents_html .= '<select name="pprf_parent_items" id="pprf-parent-items-sel" class="pprf-in-iframe-sel">'; 273 while ( $parent_pod->fetch() ) { 274 $selected_html = ''; 275 if ( $parent_pod->display( 'id' ) === $current_post_id ) { 276 $selected_html = 'selected = "selected"'; 277 } 278 $draft = ''; 279 280 if ( 'Draft' === $parent_pod->display( 'post_status' ) ) { 281 $draft = ' - draft'; 282 } 283 $parents_html .= '<option ' . $selected_html . ' value="' . esc_attr( $parent_pod->display( 'id' ) ) . '">ID: ' . esc_attr( $parent_pod->display( 'id' ) ) . ' - ' . esc_attr( $parent_pod->display( 'name' ) . $draft ) . '</option>'; 284 285 } 286 $parents_html .= '</select>'; 287 $parents_html .= '</label>'; 288 $parents_html .= '<label class="pprf-left"><strong class="mgr10 mgt5">' . esc_html__( 'field: ', 'panda-pods-repeater-field' ) . '</strong>'; 289 $parents_html .= '<select name="pprf_field pprf-left mgt5" id="pprf-field-sel" class="pprf-in-iframe-sel">'; 290 foreach ( $same_child_fields as $k => $child_fields ) { 291 $selected_html = ''; 292 if ( $child_fields['id'] === $pod_item_id && 'pandarepeaterfield' === $child_fields['type'] ) { 293 $selected_html = 'selected = "selected"'; 294 } 295 $parents_html .= '<option ' . $selected_html . ' value="' . esc_attr( $child_fields['id'] ) . '">' . esc_attr( $child_fields['label'] ) . '</option>'; 296 297 } 298 $parents_html .= '</select>'; 299 $parents_html .= '</label>'; 300 301 $parents_html .= '<label class="pprf-left">'; 302 if ( $reassignable ) { 303 $parents_html .= '<button id="pprf-reassign-btn" class="pprf-btn pprf-left mgr10 mgt5">' . esc_html__( 'Assign', 'panda-pods-repeater-field' ) . '</button>'; 304 } 305 if ( $duplicable ) { 306 $parents_html .= '<button id="pprf-duplicate-btn" class="pprf-btn pprf-left mgr10 mgt5">' . esc_html__( 'Duplicate', 'panda-pods-repeater-field' ) . '</button>'; 307 } 308 $parents_html .= '<div id="pprf-reassign-loader" class="hidden pprf-left"> 309 <img src = "' . esc_url( PANDA_PODS_REPEATER_URL . 'images/dots-loading.gif' ) . '" alt="loading" class="pdt10"/> 310 </div> '; 311 $parents_html .= '</label>'; 312 313 $parents_html .= '</div>'; 314 } 315 // phpcs:ignore 316 echo $parents_html; 317 202 318 } 203 319 } 204 205 //If reassigning or duplicating is allowed 206 if( $reassignable || $duplicable ){ 207 208 $same_child_fields = pprf_same_child_tb_fields( $parent_pod, $child_table_name ); 209 //$all_rows = $parent_pod->data(); 210 $parents_html = ''; 211 212 if ( 0 < $parent_pod->total() ) { 213 $parents_html = '<div class="pprf-left mgt10 mgb15 w100" id="pprf-bottom-wrap">'; 214 if( $parent_pages > 1 ) { 215 $parents_html .= '<label class="pprf-left"><strong class="mgr10 mgt5">' . esc_html__('Load parents: ', 'panda-pods-repeater-field' ) . '</strong>'; 216 $parents_html .= '<select name="pprf_field pprf-left mgt5" id="pprf-field-parent-loader" class="pprf-in-iframe-sel">'; 217 for( $i = 1; $i <= $parent_pages; $i ++ ){ 218 $max = $parrent_limit * $i; 219 220 if( $i === $parent_pages && $parents_total < $max ){ 221 $max = $parents_total; 222 } 223 $parents_html .= '<option value="' . $i . '">' . ( $parrent_limit * ( $i - 1 ) + 1 ) . ' - ' . $max . '</option>'; 224 225 } 226 $parents_html .= '</select>'; 227 $parents_html .= '</label>'; 228 } 229 230 $parents_html .= '<label class="pprf-left"><strong class="mgr10 mgt5">' . esc_html__('Assign to parent: ', 'panda-pods-repeater-field' ) . '</strong>'; 231 $parents_html .= '<select name="pprf_parent_items" id="pprf-parent-items-sel" class="pprf-in-iframe-sel">'; 232 while ( $parent_pod->fetch() ) { 233 $selected_html = ''; 234 if( $parent_pod->display( 'id' ) == $_GET['postid'] ){ 235 $selected_html = 'selected = "selected"'; 236 } 237 $draft = ''; 238 239 if( $parent_pod->display( 'post_status' ) == 'Draft' ){ 240 $draft = esc_attr( ' - draft', 'panda-pods-repeater-field'); 241 } 242 $parents_html .= '<option ' . $selected_html . ' value="' . esc_attr( $parent_pod->display( 'id' ) ) . '">ID: ' . esc_attr( $parent_pod->display( 'id' ) ) . ' - ' . esc_attr( $parent_pod->display( 'name' ) ) . $draft . '</option>'; 243 244 } 245 $parents_html .= '</select>'; 246 $parents_html .= '</label>'; 247 $parents_html .= '<label class="pprf-left"><strong class="mgr10 mgt5">' . esc_html__('field: ', 'panda-pods-repeater-field' ) . '</strong>'; 248 $parents_html .= '<select name="pprf_field pprf-left mgt5" id="pprf-field-sel" class="pprf-in-iframe-sel">'; 249 foreach( $same_child_fields as $k => $child_fields ){ 250 $selected_html = ''; 251 if( $child_fields['id'] == $_GET['poditemid'] && $child_fields['type'] == 'pandarepeaterfield' ){ 252 $selected_html = 'selected = "selected"'; 253 } 254 $parents_html .= '<option ' . $selected_html . ' value="' . esc_attr( $child_fields['id'] ) . '">' . esc_attr( $child_fields['label'] ) . '</option>'; 255 256 } 257 $parents_html .= '</select>'; 258 $parents_html .= '</label>'; 259 260 $parents_html .= '<label class="pprf-left">'; 261 if( $reassignable ){ 262 $parents_html .= '<button id="pprf-reassign-btn" class="pprf-btn pprf-left mgr10 mgt5">' . esc_html__('Assign', 'panda-pods-repeater-field' ) . '</button>'; 263 } 264 if( $duplicable ){ 265 $parents_html .= '<button id="pprf-duplicate-btn" class="pprf-btn pprf-left mgr10 mgt5">' . esc_html__('Duplicate', 'panda-pods-repeater-field' ) . '</button>'; 266 } 267 $parents_html .= '<div id="pprf-reassign-loader" class="hidden pprf-left"> 268 <img src = "' . esc_url( PANDA_PODS_REPEATER_URL . 'images/dots-loading.gif' ) . '" alt="loading" class="pdt10"/> 269 </div> '; 270 $parents_html .= '</label>'; 271 272 $parents_html .= '</div>'; 273 } 274 275 echo $parents_html; 276 277 } 278 } 279 } 320 } 321 } 280 322 } else { 281 echo esc_html__( 'Invalid table', 'panda-pods-repeater-field' );323 echo esc_html__( 'Invalid table', 'panda-pods-repeater-field' ); 282 324 } 283 325 echo '<div id="pprf-reassign-ajax-message"></div>'; … … 287 329 <br/> 288 330 <br/> 289 <div class="click-to-close-arrow aligncenter" title="Click this bar to close" ><?php esc_html_e('Click here to collapse', 'panda-pods-repeater-field' ); ?></div> 290 291 <?php 292 foreach( $_GET as $key => $value ){ 293 294 } 295 ?> 331 <div class="click-to-close-arrow aligncenter" title="Click this bar to close" ><?php esc_html_e( 'Click here to collapse', 'panda-pods-repeater-field' ); ?></div> 332 296 333 <script type="text/javascript"> 297 334 … … 302 339 // height on load, 40 is for the padding top and bottom 303 340 var pprf_test_orgHei_int = jQuery('html body #pprf-form').height() + pprf_bottom_wrap_height + 60; 304 function pprf_resize_window( new_height ) { 305 341 function pprf_resize_window( new_height ) { 342 306 343 pprf_bottom_wrap_height = jQuery('html body #pprf-bottom-wrap').height() || 0; 307 if( typeof new_height == 'undefined'){344 if( 'undefined' === typeof new_height ){ 308 345 pprf_original_height = jQuery('html body #pprf-form').height() + pprf_bottom_wrap_height + 60; 309 310 346 } else { 311 347 pprf_original_height = new_height; 312 313 } 348 } 314 349 315 350 pprf_update_parent(); 316 //parent.pprfParentheight; 317 } 318 319 function pprf_update_parent() { 351 } 352 353 function pprf_update_parent() { 320 354 321 355 var height = pprf_original_height; 322 if( jQuery('.media-modal').length != 0){356 if( 0 !== jQuery('.media-modal').length ){ 323 357 height = jQuery('.media-modal').height() + pprf_original_height; 324 358 } 325 326 if( jQuery('#ui-datepicker-div').length != 0 && jQuery('#ui-datepicker-div').css('display') == 'block'){359 360 if( 0 !== jQuery('#ui-datepicker-div').length && 'block' === jQuery('#ui-datepicker-div').css('display') ){ 327 361 height += jQuery('#ui-datepicker-div').height(); 328 362 } else { 329 if( jQuery('#ui-colorpicker-div').length != 0 && jQuery('#ui-colorpicker-div').css('display') == 'block'){363 if( 0 !== jQuery('#ui-colorpicker-div').length && 'block' === jQuery('#ui-colorpicker-div').css('display') ){ 330 364 height += jQuery('#ui-colorpicker-div').height(); 331 365 } 332 366 } 333 367 334 368 if( typeof parent.pprf_update_iframe_size == 'function' ){ 335 parent.pprf_update_iframe_size('<?php echo esc_attr( $iframe_id ); ?>', height); 336 } 337 <?php 338 if( $parent_iframe_id != '' ){ 339 ?> 340 //call the resize function in the parent iframe, nested iframe only 341 //parent.pprf_resize_window(); 342 343 <?php 344 } 345 ?> 369 parent.pprf_update_iframe_size('<?php echo esc_js( $iframe_id ); ?>', height); 370 } 371 346 372 pprf_loaded_resized = false; 347 373 } 348 374 349 375 jQuery(document).ready( function($) { 350 376 351 377 <?php 352 if ( isset( $_GET['itemid'] ) ){353 ?>378 if ( isset( $item_id ) ) { 379 ?> 354 380 $('#pprf-reassign-btn').on('click', function(){ 355 381 var data_obj = { 356 382 action : 'admin_pprf_reassign', 357 383 security : ajax_script.nonce, 358 podid : '<?php echo esc_js( $_GET['podid']); ?>',359 cpodid : '<?php echo esc_js( $_GET['tb']); ?>',384 podid : '<?php echo intval( $pod_id ); ?>', 385 cpodid : '<?php echo intval( $pod_table_id ); ?>', 360 386 postid : $('#pprf-parent-items-sel').val(), 361 387 poditemid : $('#pprf-field-sel').val(), 362 curPItemid : '<?php echo esc_js( $_GET['poditemid'] );?>',363 itemid : '<?php echo esc_js( $_GET['itemid'] );?>',388 curPItemid : '<?php echo intval( $pod_item_id ); ?>', 389 itemid : '<?php echo intval( $item_id ); ?>', 364 390 }; 365 391 $('#pprf-reassign-loader').removeClass('hidden'); … … 379 405 action : 'admin_pprf_duplicate', 380 406 security : ajax_script.nonce, 381 podid : '<?php echo esc_js( $_GET['podid']); ?>',382 cpodid : '<?php echo esc_js( $_GET['tb']); ?>',383 postid : '<?php echo esc_js( $_GET['postid']); ?>',407 podid : '<?php echo intval( $pod_id ); ?>', 408 cpodid : '<?php echo intval( $pod_table_id ); ?>', 409 postid : '<?php echo intval( $current_post_id ); ?>', 384 410 new_post_id : $('#pprf-parent-items-sel').val(), 385 411 poditemid : $('#pprf-field-sel').val(), 386 curPItemid : '<?php echo esc_js( $_GET['poditemid'] );?>',387 item_id : '<?php echo esc_js( $_GET['itemid'] );?>',412 curPItemid : '<?php echo intval( $pod_item_id ); ?>', 413 item_id : '<?php echo intval( $item_id ); ?>', 388 414 }; 389 415 $('#pprf-reassign-loader').removeClass('hidden'); … … 394 420 function( response_obj ){ 395 421 $('#pprf-reassign-loader').addClass('hidden'); 396 397 422 $('#pprf-reassign-ajax-message').html( response_obj['data']['message'] ); 398 423 pprf_resize_window(); 399 424 } 400 425 ); 401 }) 426 }) 402 427 403 428 $('#pprf-field-parent-loader').on('change', function(){ … … 405 430 action : 'admin_pprf_load_parent_items', 406 431 security : ajax_script.nonce, 407 podid : '<?php echo esc_js( $_GET['podid']); ?>',408 cpodid : '<?php echo esc_js( $_GET['tb']); ?>',432 podid : '<?php echo intval( $pod_id ); ?>', 433 cpodid : '<?php echo intval( $pod_table_id ); ?>', 409 434 page : $('#pprf-field-parent-loader').val(), 410 curPItemid : '<?php echo esc_js( $_GET['poditemid'] );?>',411 itemid : '<?php echo esc_js( $_GET['itemid'] );?>',412 postid : '<?php echo esc_js( $_GET['postid'] );?>',413 limit : '<?php echo $parrent_limit;?>',435 curPItemid : '<?php echo intval( $pod_item_id ); ?>', 436 itemid : '<?php echo intval( $item_id ); ?>', 437 postid : '<?php echo intval( $current_post_id ); ?>', 438 limit : '<?php echo (int) $parrent_limit; ?>', 414 439 }; 415 440 $('#pprf-reassign-loader').removeClass('hidden'); … … 425 450 ); 426 451 }) 427 <?php428 } 429 ?> 430 // remove update messages452 <?php 453 } 454 ?> 455 // Remove update messages. 431 456 $('.updated, .update-nag').remove(); 432 // remove admin outlook457 // Remove admin outlook. 433 458 $('#adminmenuback, #adminmenuwrap, #wpadminbar, #wpfooter, #screen-meta-links, #screen-meta').remove(); 434 459 … … 436 461 pprf_resize_window( ); 437 462 }) 438 //$( this ).on( 'click, mouseenter, mouseout, mouseleave', function(){ 463 439 464 $( '.click-to-expand, .click-to-expand-arrow' ).on( 'click', function(){ 440 441 // if the iframe has not been resized 442 //if( pprf_loaded_resized == false ){ 443 pprf_resize_window(); 444 445 pprf_loaded_resized = true; 446 //} 465 // If the iframe has not been resized. 466 pprf_resize_window(); 467 pprf_loaded_resized = true; 447 468 }) 469 448 470 $( '.click-to-close, .click-to-close-arrow' ).on( 'click', function(){ 449 471 pprf_resize_window( 150 ); … … 451 473 }) 452 474 453 454 475 <?php 455 456 // if successfully added a new one 457 if( isset( $_GET['success'] ) && $_GET['success'] == 1 && isset( $_GET['iframe_id'] ) && strpos( $_GET['iframe_id'], 'panda-repeater-add-new' ) === 0 ){ 458 global $wpdb; 459 $lastid = $wpdb->insert_id; 476 // If successfully added a new one. 477 if ( 1 === $success && '' !== $iframe_id ) { 478 479 if ( 0 === strpos( $iframe_id, 'panda-repeater-add-new' ) ) { 480 global $wpdb; 481 482 $item_title = wp_strip_all_tags( str_replace( array( '(', ')' ), '', get_the_title( $pod_item_id ) ) ); 483 ?> 484 parent.pprf_new( <?php echo (int) $pod_id; ?>, <?php echo (int) $current_post_id; ?>, <?php echo (int) $pod_table_id; ?>, <?php echo (int) $current_user->ID; ?>, '<?php echo esc_js( $iframe_id ); ?>', <?php echo (int) $pod_item_id; ?>, '<?php echo esc_js( $item_title ); ?>' ); 485 <?php 486 } 487 } 488 460 489 ?> 461 parent.pprf_new( <?php echo $_GET['podid'];?>, "<?php echo $_GET['postid'];?>", <?php echo $_GET['tb'];?>, <?php echo $current_user->ID;?>, '<?php echo $_GET['iframe_id']; ?>', <?php echo $_GET['poditemid']; ?>, '<?php echo esc_attr( get_the_title( $_GET['poditemid'] ) ); ?>' ); 462 <?php 463 } 464 // disable it until I am sure it is not needed 465 if( 1 == 0 && isset( $_GET['itemid'] ) && is_numeric( $_GET['itemid'] ) ){ 466 ?> 467 // tell the parent window to delete this item 468 $('.panda-repeater-field-delete-bn').on('click', function(){ 469 parent.pprf_delete_item( <?php echo $_GET['podid'];?>, "<?php echo $_GET['postid'];?>", <?php echo $_GET['tb'];?>, <?php echo $_GET['itemid'];?>, <?php echo $current_user->ID;?>, '<?php echo $_GET['iframe_id']; ?>', <?php echo $_GET['poditemid']; ?> ); 470 pprf_resize_window(); 490 491 // Saved, so don't popup the confirm box to ask if to ignore changes. 492 $( document ).on('click', '.pods-submit-button', function (){ 493 parent.pprf_is_changed = false; 494 }) 495 $('.pods-field-input').on('click keyup change', function(){ 496 parent.pprf_is_changed = true; 471 497 }); 472 <?php473 }474 475 ?>476 // saved, so don't popup the confirm box to ask if to ignore changes477 // $('.pods-submit-button').click( function (){478 $( document ).on('click', '.pods-submit-button', function (){479 parent.pprf_is_changed = false;480 })481 $('.pods-field-input').on('click keyup change', function(){482 parent.pprf_is_changed = true;483 });484 498 485 499 /** 486 * after running all javascript, resize the window500 * After running all javascript, resize the window. 487 501 */ 488 //$(window).load(function(){ 489 pprf_resize_window(); 490 //} ); 502 pprf_resize_window(); 503 491 504 }) 492 505 </script> 493 506 <script type="text/javascript"> 494 495 507 if ( window == window.top ) { 496 document.body.innerHTML = 'Access denied!';508 document.body.innerHTML = 'Access denied!'; 497 509 } 498 510 </script> 499 511 <?php 500 if ( !$is_admin ){512 if ( ! $is_admin ) { 501 513 wp_footer(); 502 514 } -
panda-pods-repeater-field/trunk/js/admin.js
r2829601 r2837947 1 1 "use strict"; 2 2 3 /** 4 * The JS file for the repeater field 5 * 6 * @package panda_pods_repeater_field 7 * @author Dongjie Xu 8 */ 9 10 /** 11 * Collection for JS functions 12 * 13 * @package panda_pods_repeater_field 14 * @author Dongjie Xu 15 * @since 09/02/2016 16 */ 3 17 function pprf_resize_iframe(obj) { 4 18 obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px'; … … 35 49 var pprf_parent_height = jQuery('html').height(); 36 50 /** 37 * insert a new row to the page after adding a new item51 * Insert a new row to the page after adding a new item. 38 52 */ 39 53 40 54 function pprf_new(podid, postid, cpodid, authorid, iframeid, poditemid, parent_name) { 41 if ( jQuery.isNumeric(podid) && jQuery.isNumeric(cpodid) && jQuery.isNumeric(authorid) && jQuery.isNumeric(poditemid)) {55 if (false === isNaN(podid) && false === isNaN(cpodid) && false === isNaN(authorid) && false === isNaN(poditemid)) { 42 56 var para_obj = { 43 57 'podid': podid, … … 50 64 }; 51 65 var data_obj = para_obj; 52 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '- ' + 'loader').removeClass('hidden');66 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-loader').removeClass('hidden'); 53 67 jQuery.post(ajax_script.ajaxurl, data_obj, function (responses) { 54 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '- ' + 'loader').addClass('hidden');55 var response_data = responses['data']; //console.log( response_data );56 57 if (responses['success'] === true && typeof response_data['id'] !== 'undefined' && jQuery.isNumeric(response_data['id'])) {68 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-loader').addClass('hidden'); 69 var response_data = responses['data']; 70 71 if (responses['success'] === true && typeof response_data['id'] !== 'undefined' && false === isNaN(response_data['id'])) { 58 72 var iframe_build = pprf_build_item_html(response_data, podid, postid, cpodid, authorid, iframeid, poditemid, parent_name, false); 59 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list').append(iframe_build); // if entries limit, toggle the add new73 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list').append(iframe_build); // If entries limit, toggle the add new. 60 74 61 75 var items_left_count = jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li').length; … … 65 79 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new').addClass('hidden'); 66 80 } 67 } // if add a new one, activeate the live items tab 68 69 70 jQuery('#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab .dashicons-portfolio').click(); //jQuery( document ).on('click', '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab .dashicons-portfolio' ); 71 81 } // If add a new one, activeate the live items tab. 82 83 84 jQuery('#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab .dashicons-portfolio').click(); 72 85 pprf_odd_even_color(cpodid + '-' + poditemid); 73 86 }); … … 76 89 77 90 function pprf_build_item_html(items, podid, postid, cpodid, authorid, iframeid, poditemid, parent_name, is_repeated) { 78 if (typeof items['id'] == 'undefined' || !jQuery.isNumeric(items['id']) || !jQuery.isNumeric(podid)) {91 if (typeof items['id'] == 'undefined' || true === isNaN(items['id']) || true === isNaN(podid)) { 79 92 return ''; 80 } //console.log(items); 81 93 } 82 94 83 95 var trashed_css = ''; … … 89 101 if (typeof items['trashed'] != 'undefined' && items['trashed'] == 1) { 90 102 trashed_css = 'pprf-trashed'; 91 btn_trashed_css = 'pprf-btn-trashed'; // if the portfolio foder is open, hide the trash one103 btn_trashed_css = 'pprf-btn-trashed'; // If the portfolio foder is open, hide the trash one. 92 104 93 105 edit_icon_css = 'dashicons-update '; … … 112 124 } 113 125 114 var delete_action = ''; //jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-' + 'add-new .pprf-trash-btn' ).data('target'); 115 126 var delete_action = ''; 116 127 var ids_in_css = cpodid + '-' + items['id'] + '-' + poditemid; 117 128 var responding_id = items['id']; 118 129 var the_title = items['title']; 119 var the_label = the_title; //var the_label = '<strong>ID:</strong> ' + responding_id + ' <strong>' + items['pprf_name_label'] + ': </strong> ' + the_title;130 var the_label = the_title; 120 131 121 132 if (typeof items['label'] != 'undefined' && items['label'] != '') { … … 124 135 125 136 var next_background_css = jQuery('#next-bg').data('bg'); 126 var full_url = PANDA_PODS_REPEATER_PAGE_URL[0] + 'iframe_id=panda-repeater-edit-' + ids_in_css + '&podid=' + podid + '&tb=' + cpodid + '&postid=' + postid + '&itemid=' + responding_id + '&poditemid=' + poditemid ;137 var full_url = PANDA_PODS_REPEATER_PAGE_URL[0] + 'iframe_id=panda-repeater-edit-' + ids_in_css + '&podid=' + podid + '&tb=' + cpodid + '&postid=' + postid + '&itemid=' + responding_id + '&poditemid=' + poditemid + '&pprf_nonce=' + PANDA_PODS_REPEATER_CONSTANTS.nonce; 127 138 var html_build = '<li data-id="' + responding_id + '" class="' + trashed_css + '" id="li-' + ids_in_css + repeated_css_append + '" style="' + display_style + '">' + '<div class="pprf-row w100 pprf-left">' + '<div class="w100 pprf-left" id="pprf-row-brief-' + ids_in_css + repeated_css_append + '">' + '<div class="pprf-left pd8 pprf-left-col ' + next_background_css + ' ">' + the_label + '</div>'; 128 139 … … 130 141 html_build += '<div class="button pprf-right-col center pprf-dismiss-btn ' + delete_action + ' ' + btn_trashed_css + '" role="button" data-podid="' + podid + '" data-postid="' + postid + '" data-tb="' + cpodid + '" data-itemid="' + responding_id + '" data-userid="' + authorid + '" data-iframe_id="panda-repeater-edit-' + ids_in_css + '" data-poditemid="' + poditemid + '" data-target="' + ids_in_css + '" >' + '<span class="dashicons dashicons-dismiss pdt6 mgb0 "></span>' + '</div>' + '<div class="pprf-left pd8">Repeated</div>'; 131 142 } else { 132 html_build += '<div class="button pprf-right-col center pprf-trash-btn ' + delete_action + ' ' + btn_trashed_css + '" role="button" data-podid="' + podid + '" data-postid="' + postid + '" data-tb="' + cpodid + '" data-itemid="' + responding_id + '" data-userid="' + authorid + '" data-iframe_id="panda-repeater-edit-' + ids_in_css + '" data-poditemid="' + poditemid + '" data-target="' + ids_in_css + '" >' + '<span class="dashicons dashicons-trash pdt6 mgb0 "></span>' + '<div id="panda-repeater-trash-' + ids_in_css + '-loader" class="pprf-left hidden mgl5">' + '<img src = "' + PANDA_PODS_REPEATER_ URL[0] + '/images/dots-loading.gif" alt="loading" class="mgl8 loading pprf-left"/>' + '</div>' + '</div>' + '<div class="button pprf-right-col center pprf-save-btn" role="button" data-podid="' + podid + '" data-postid="' + postid + '" data-tb="' + cpodid + '" data-itemid="' + responding_id + '" data-userid="' + authorid + '" data-iframe_id="panda-repeater-edit-' + ids_in_css + '" data-poditemid="' + poditemid + '" data-target="' + ids_in_css + '" >' + '<img src = "' + PANDA_PODS_REPEATER_URL[0] + 'images/save-icon-tran.png" class="pprf-save-icon mgt8 mgb2"/>' + '<div id="panda-repeater-save-' + ids_in_css + '-loader" class="pprf-left hidden mgl5">' + '<img src = "' + PANDA_PODS_REPEATER_URL[0] + 'images/dots-loading.gif" alt="loading" class="mgl8 pprf-left"/>' + '</div>' + '</div>' + '<div class="button pprf-edit pprf-row-load-iframe alignright pprf-right-col center pprf-edit-btn" role="button" data-target="' + ids_in_css + '" data-url="' + full_url + '">' + '<span class="dashicons ' + edit_icon_css + ' pdt8 mgb0 pprf-edit-span"></span>' + '<div id="panda-repeater-edit-' + ids_in_css + '-loader" class="pprf-left hidden mgl5">' + '<img src = "' + PANDA_PODS_REPEATER_URL[0]+ '/images/dots-loading.gif" alt="loading" class="mgl9 pprf-left"/>' + '</div> ' + '</div>';143 html_build += '<div class="button pprf-right-col center pprf-trash-btn ' + delete_action + ' ' + btn_trashed_css + '" role="button" data-podid="' + podid + '" data-postid="' + postid + '" data-tb="' + cpodid + '" data-itemid="' + responding_id + '" data-userid="' + authorid + '" data-iframe_id="panda-repeater-edit-' + ids_in_css + '" data-poditemid="' + poditemid + '" data-target="' + ids_in_css + '" >' + '<span class="dashicons dashicons-trash pdt6 mgb0 "></span>' + '<div id="panda-repeater-trash-' + ids_in_css + '-loader" class="pprf-left hidden mgl5">' + '<img src = "' + PANDA_PODS_REPEATER_CONSTANTS.url + '/images/dots-loading.gif" alt="loading" class="mgl8 loading pprf-left"/>' + '</div>' + '</div>' + '<div class="button pprf-right-col center pprf-save-btn" role="button" data-podid="' + podid + '" data-postid="' + postid + '" data-tb="' + cpodid + '" data-itemid="' + responding_id + '" data-userid="' + authorid + '" data-iframe_id="panda-repeater-edit-' + ids_in_css + '" data-poditemid="' + poditemid + '" data-target="' + ids_in_css + '" >' + '<img src = "' + PANDA_PODS_REPEATER_CONSTANTS.url + 'images/save-icon-tran.png" class="pprf-save-icon mgt8 mgb2"/>' + '<div id="panda-repeater-save-' + ids_in_css + '-loader" class="pprf-left hidden mgl5">' + '<img src = "' + PANDA_PODS_REPEATER_CONSTANTS.url + 'images/dots-loading.gif" alt="loading" class="mgl8 pprf-left"/>' + '</div>' + '</div>' + '<div class="button pprf-edit pprf-row-load-iframe alignright pprf-right-col center pprf-edit-btn" role="button" data-target="' + ids_in_css + '" data-url="' + full_url + '">' + '<span class="dashicons ' + edit_icon_css + ' pdt8 mgb0 pprf-edit-span"></span>' + '<div id="panda-repeater-edit-' + ids_in_css + '-loader" class="pprf-left hidden mgl5">' + '<img src = "' + PANDA_PODS_REPEATER_CONSTANTS.url + '/images/dots-loading.gif" alt="loading" class="mgl9 pprf-left"/>' + '</div> ' + '</div>'; 133 144 } 134 145 135 146 html_build += '</div>' + '<div>' + '<iframe id="panda-repeater-edit-' + ids_in_css + '" frameborder="0" scrolling="no" src="" style="display:none; " class="panda-repeater-iframe w100"></iframe>' + '<div id="panda-repeater-edit-expand-' + ids_in_css + '" class="w100 pprf-left center pdt3 pdb3 pprf-expand-bar pprf-edit-expand" data-target="' + ids_in_css + '" style="display:none;">Content missing? Click here to expand</div>' + '</div>' + '</div>' + '</li>'; 136 147 137 if (next_background_css == 'pprf-purple-bg') {148 if (next_background_css === 'pprf-purple-bg') { 138 149 jQuery('#next-bg').data('bg', 'pprf-white-bg'); 139 150 } else { … … 144 155 } 145 156 /** 146 * delete an item157 * Delete an item 147 158 */ 148 159 149 160 150 161 function pprf_delete_item(podid, postid, cpodid, itemid, authorid, iframeid, poditemid, trashed) { 151 if ( jQuery.isNumeric(podid) && jQuery.isNumeric(cpodid) && jQuery.isNumeric(authorid) && jQuery.isNumeric(itemid) && jQuery.isNumeric(poditemid)) {162 if (false === isNaN(podid) && false === isNaN(cpodid) && false === isNaN(authorid) && false === isNaN(itemid) && false === isNaN(poditemid)) { 152 163 var para_obj = { 153 164 'podid': podid, … … 173 184 if (trashed == 2) { 174 185 info_text = strs_obj.be_deleted; 175 } //panda-repeater-edit-13-506 236 176 186 } 177 187 178 188 var data_obj = para_obj; 179 var pass t_bln = confirm(strs_obj.you_sure + ' ' + info_text); //$('#overlord').removeClass('hidden');180 181 if (pass t_bln== true) {189 var passed = confirm(strs_obj.you_sure + ' ' + info_text); 190 191 if (passed === true) { 182 192 if (trashed == 0) { 183 193 jQuery('#panda-repeater-edit-' + cpodid + '-' + itemid + '-' + poditemid + '-loader').removeClass('hidden'); 184 194 } else { 185 195 jQuery('#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader').removeClass('hidden'); 186 } //jQuery( '#pprf-row-brief-' + cpodid + '-' + itemid + '-' + poditemid + ' .pprf-trash-btn .dashicons-trash' ).remove( ); 187 196 } 188 197 189 198 jQuery.post(ajax_script.ajaxurl, data_obj, function (responses) { … … 200 209 } else { 201 210 jQuery('#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader').addClass('hidden'); 202 } //jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' #' + iframeid ).remove( ); 203 211 } 204 212 205 213 if (trashed == 0) { … … 213 221 214 222 if (jQuery.trim(jQuery('#' + iframe_build).contents().find("body").html()) != '') { 215 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"] .pprf-save-btn .pprf-save-icon').attr('src', PANDA_PODS_REPEATER_ URL[0]+ 'images/save-icon.png');223 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"] .pprf-save-btn .pprf-save-icon').attr('src', PANDA_PODS_REPEATER_CONSTANTS.url + 'images/save-icon.png'); 216 224 } 217 225 } … … 235 243 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"] .pprf-trash-btn').addClass('pprf-btn-trashed'); 236 244 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"] .pprf-trash-btn').removeClass('pprf-btn-not-trashed'); 237 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"] .pprf-save-btn .pprf-save-icon').attr('src', PANDA_PODS_REPEATER_ URL[0]+ 'images/save-icon-tran.png');245 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"] .pprf-save-btn .pprf-save-icon').attr('src', PANDA_PODS_REPEATER_CONSTANTS.url + 'images/save-icon-tran.png'); 238 246 } 239 247 240 248 if (trashed == 2) { 241 249 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' #' + iframeid).parent().parent().remove(); 242 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"]').remove(); // if entries limit, toggle the add new250 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"]').remove(); // If entries limit, toggle the add new. 243 251 244 252 var items_left_count = jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li').length; … … 247 255 if (limit_int != 0 && items_left_count < limit_int) { 248 256 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new').removeClass('hidden'); 249 } // integrate with simpods js257 } // Integrate with simpods js. 250 258 251 259 … … 253 261 call_simpods(responses); 254 262 } 255 } //document.getElementById( iframeid ).contentWindow.pprf_resize_window() ; 256 263 } 257 264 258 265 pprf_odd_even_color(cpodid + '-' + poditemid); … … 262 269 } 263 270 } 264 } //jQuery('.pprf-redorder-btn').click( function(){ 265 271 } 266 272 267 273 jQuery(document).on('click', '.pprf-redorder-btn', function (evt) { … … 272 278 jQuery(this).parent().children('.pprf-row').addClass('hidden'); 273 279 jQuery('#' + id + '-add-new').addClass('hidden'); 274 }); //jQuery('.pprf-save-redorder-btn').click( function(){ 275 280 }); 276 281 jQuery(document).on('click', '.pprf-save-redorder-btn', function (evt) { 277 282 var id = jQuery(this).data('id'); … … 284 289 }); 285 290 /** 286 * load more291 * Load more. 287 292 */ 288 //jQuery('.pprf-load-more-btn').click( function( evt ){289 293 290 294 jQuery(document).on('click', '.pprf-load-more-btn', function (evt) { … … 321 325 322 326 if (response_obj.success == true) { 323 var trashed_count = 0; //var not_trashed_count = 0; 324 325 for (var i = 0; i < response_obj.data.length; i++) { 327 var trashed_count = 0; 328 var data_length = response_obj.data.length; 329 var loaded_length = loaded_arr.length; 330 331 for (var i = 0; i < data_length; i++) { 326 332 var is_repeated = false; 327 333 328 if (jQuery('#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load').val() == 'append_to') {329 // only need to check repeatition if it is on Append To.330 for (var j = 0; j < loaded_ arr.length; j++) {331 // inArry doesn't work334 if (jQuery('#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load').val() === 'append_to') { 335 // Only need to check repeatition if it is on Append To. 336 for (var j = 0; j < loaded_length; j++) { 337 // InArry doesn't work. 332 338 if (parseInt(response_obj.data[i]['id']) == loaded_arr[j]) { 333 339 is_repeated = true; … … 364 370 365 371 jQuery('#pprf-load-more-wrap-' + target_str + ' .pprf-load-more-report').text(' | Loaded ' + info_text); 366 } //pprf_build_item_html( items, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name ) 367 //pprf_new( ele_obj.data('podid'), ele_obj.data('postid'), ele_obj.data('tb'), ele_obj.data('userid'), ele_obj.data('iframe_id'), ele_obj.data('pod_item_id'), ele_obj.data('cptitle') ); 368 372 } 369 373 }); 370 374 } 371 375 /** 372 * reset colours for each row376 * Reset colours for each row. 373 377 */ 374 378 … … 404 408 } 405 409 /** 406 * if reassigned successfully, remove the item and reset colours410 * If reassigned successfully, remove the item and reset colours. 407 411 */ 408 412 409 413 410 414 function pprf_reassign(cpodid, poditemid, itemid) { 411 //console.log( cpodid, poditemid, itemid ); 412 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"]').remove(); //document.getElementById( iframeid ).contentWindow.pprf_resize_window() ; 413 415 jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id="' + itemid + '"]').remove(); 414 416 pprf_odd_even_color(cpodid + '-' + poditemid); 415 417 } … … 417 419 jQuery(document).ready(function ($) { 418 420 /** 419 * fix_helper_modified for drag and drop421 * Fix_helper_modified for drag and drop. 420 422 */ 421 423 var fix_helper_modified = function fix_helper_modified(e, tr) { … … 460 462 461 463 if ($(this).children('.pprf-edit-span').hasClass('dashicons-update')) { 462 // restore this item464 // Restore this item. 463 465 pprf_delete_item(trash_ele.data('podid'), trash_ele.data('postid'), trash_ele.data('tb'), trash_ele.data('itemid'), trash_ele.data('userid'), trash_ele.data('iframe_id'), trash_ele.data('poditemid'), 0); 464 466 } else { … … 472 474 473 475 if ($('#pprf-row-brief-' + ids_in_css + ' .dashicons').hasClass('dashicons-edit')) { 474 // if iframe not loaded476 // If iframe not loaded. 475 477 if ($('#' + iframe_build).attr('src') == '') { 476 478 $('#' + iframe_build).attr('src', url_str); 477 $('#' + iframe_build + '- ' + 'loader').removeClass('hidden');479 $('#' + iframe_build + '-loader').removeClass('hidden'); 478 480 } 479 481 … … 484 486 $('#' + exp_str).show(); 485 487 $('#' + iframe_build).on('load', function () { 486 $('#' + iframe_build + '-' + 'loader').addClass('hidden'); //change icon 487 488 $('#panda-repeater-save-' + ids_in_css + '-' + 'loader').parent().children('.pprf-save-icon').attr('src', PANDA_PODS_REPEATER_URL[0] + '/images/save-icon.png'); 489 $('#panda-repeater-save-' + ids_in_css + '-' + 'loader').parent().addClass('pprf-btn-ready'); 490 $('#panda-repeater-save-' + ids_in_css + '-' + 'loader').addClass('hidden'); //$('#pprf-row-brief-' + ids_in_css + '' ).addClass('hidden'); 491 //$('#' + iframe_build )[0].contentWindow.pprf_resize_window(); 492 //console.log( $(this).parent().height() ); 493 494 $('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons').addClass('dashicons-arrow-up'); 495 $('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons').removeClass('dashicons-edit'); 496 }); // if( $('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass('dashicons') ){ 497 //} 488 $('#' + iframe_build + '-loader').addClass('hidden'); // Change icon. 489 490 $('#panda-repeater-save-' + ids_in_css + '-loader').parent().children('.pprf-save-icon').attr('src', PANDA_PODS_REPEATER_CONSTANTS.url + '/images/save-icon.png'); 491 $('#panda-repeater-save-' + ids_in_css + '-loader').parent().addClass('pprf-btn-ready'); 492 $('#panda-repeater-save-' + ids_in_css + '-loader').addClass('hidden'); 493 $('#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons').addClass('dashicons-arrow-up'); 494 $('#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons').removeClass('dashicons-edit'); 495 }); 498 496 } else { 499 497 $('#' + iframe_build).hide('slow', function () { 500 $('#pprf-row-brief-' + ids_in_css + '' +addEdit_str + ' .dashicons').removeClass('dashicons-arrow-up');501 $('#pprf-row-brief-' + ids_in_css + '' +addEdit_str + ' .dashicons').addClass('dashicons-edit');498 $('#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons').removeClass('dashicons-arrow-up'); 499 $('#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons').addClass('dashicons-edit'); 502 500 }); 503 $('#' + exp_str).hide(); // if( $('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass('dashicons') ){ 504 // } 501 $('#' + exp_str).hide(); 505 502 } 506 503 … … 509 506 }); 510 507 /** 511 * click to explan its iframe508 * Click to explan its iframe. 512 509 */ 513 510 … … 527 524 }); 528 525 /** 529 * click to delete526 * Click to delete. 530 527 */ 531 528 … … 572 569 }); 573 570 /** 574 * if a pods is is clicked, flag it as saved571 * If a pods is is clicked, flag it as saved. 575 572 */ 576 573 … … 584 581 585 582 if (leave == true) { 586 pprf_is_changed = false; //$( this ).click(); 587 583 pprf_is_changed = false; 588 584 $(this).trigger('click'); 589 585 } … … 595 591 }); 596 592 /** 597 * toggle trashed and current593 * Toggle trashed and current. 598 594 */ 599 595 … … 613 609 }); 614 610 /** 615 * remove repeated611 * Remove repeated. 616 612 */ 617 613 -
panda-pods-repeater-field/trunk/js/admin.js.map
r2829601 r2837947 1 {"version":3,"sources":["admin.js"],"names":["pprf_resize_iframe","obj","style","height","contentWindow","document","body","scrollHeight","pprf_update_iframe_size","x","y","jQuery","animate","pprf_update_size","pprf_original_height","pprf_update_parent_iframe","pprf_parent_height","pprf_new","podid","postid","cpodid","authorid","iframeid","poditemid","parent_name","isN umeric","para_obj","ajax_script","nonce","data_obj","removeClass","post","ajaxurl","responses","addClass","response_data","iframe_build","pprf_build_item_html","append","items_left_count","length","limit_int","parseInt","val","click","pprf_odd_even_color","items","is_repeated","trashed_css","btn_trashed_css","display_style","edit_icon_css","data","hasClass","repeated_css_append","delete_action","ids_in_css","responding_id","the_title","the_label","next_background_css","full_url","PANDA_PODS_REPEATER_PAGE_URL","html_build","PANDA_PODS_REPEATER_URL","pprf_delete_item","itemid","trashed","info_text","strs_obj","be_restored","can_recover","be_deleted","passt_bln","confirm","you_sure","exp_str","css","trim","contents","find","html","attr","hide","parent","remove","call_simpods","isFunction","on","evt","id","children","preventDefault","pprf_load_more","target_str","ele_obj","loaded_arr","Array","each","idx_int","action","loaded","security","pod_id","post_id","saved_tb","iframe_id","pod_item_id","cp_title","trashable","order","order_by","amount","start","text","response_obj","success","trashed_count","i","j","ids","idx","pprf_reassign","ready","$","fix_helper_modified","e","tr","$originals","$helper","clone","index","width","eq","update_index","ui","the_order","sortable","resp_arr","pprf_id","helper","cursor","opacity","tolerance","update","cancel","handle","stopPropagation","url_str","trash_ele","addEdit_str","show","iframe","getElementById","pprf_resize_window","trash","trigger","pprf_is_changed","leave","Ignore_changes"],"mappings":";;AAAA,SAASA,kBAAT,CAA4BC,GAA5B,EAAiC;AAChCA,EAAAA,GAAG,CAACC,KAAJ,CAAUC,MAAV,GAAmBF,GAAG,CAACG,aAAJ,CAAkBC,QAAlB,CAA2BC,IAA3B,CAAgCC,YAAhC,GAA+C,IAAlE;AAEA;;AAED,SAASC,uBAAT,CAAkCC,CAAlC,EAAqCC,CAArC,EAAwC;AAEvC,MAAKD,CAAC,IAAI,EAAV,EAAe;AACdE,IAAAA,MAAM,CAAC,MAAMF,CAAP,CAAN,CAAgBN,MAAhB,CAAwBQ,MAAM,CAAC,MAAMF,CAAP,CAAN,CAAgBN,MAAhB,EAAxB,EAAmDS,OAAnD,CAA2D;AAACT,MAAAA,MAAM,EAAEO;AAAT,KAA3D,EAAwE,GAAxE;AACA;AACD;;AACD,SAASG,gBAAT,CAA2BJ,CAA3B,EAA8B;AAE7B,MAAKA,CAAC,IAAI,EAAV,EAAe;AACd,QAAIK,oBAAoB,GAAGH,MAAM,CAAEF,CAAC,GAAG,uBAAN,CAAN,CAAqCN,MAArC,KAAgD,EAA3E;AAEAQ,IAAAA,MAAM,CAAC,MAAMF,CAAP,CAAN,CAAgBN,MAAhB,CAAwBQ,MAAM,CAAC,MAAMF,CAAP,CAAN,CAAgBN,MAAhB,EAAxB,EAAmDS,OAAnD,CAA2D;AAACT,MAAAA,MAAM,EAAEW;AAAT,KAA3D,EAA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E,CAAD,CAAoFyB,GAApF,CAAwF,SAAxF,EAAmG,MAAnG;AACA+C,IAAAA,CAAC,CAAE,4BAA4BA,CAAC,CAAE,IAAF,CAAD,CAASxC,MAAT,GAAkBhC,IAAlB,CAAuB,QAAvB,CAA5B,GAA+D,oBAAjE,CAAD,CAAwFyB,GAAxF,CAA4F,SAA5F,EAAuG,OAAvG;AACA+C,IAAAA,CAAC,CAAE,IAAF,CAAD,CAAUxC,MAAV,GAAmBA,MAAnB,GAA4BO,QAA5B,CAAqC,SAArC,EAAgD7D,WAAhD,CAA4D,QAA5D;AACA8F,IAAAA,CAAC,CAAE,IAAF,CAAD,CAAUxC,MAAV,GAAmBlD,QAAnB,CAA4B,QAA5B;AACAW,IAAAA,mBAAmB,CAAE+E,CAAC,CAAE,IAAF,CAAD,CAASxC,MAAT,GAAkBhC,IAAlB,CAAuB,QAAvB,CAAF,CAAnB;AACD,GAND;AAQC;AACF;AACA;;AACEwE,EAAAA,CAAC,CAACvH,QAAQ,CAACC,IAAV,CAAD,CAAiBkF,EAAjB,CAAoB,OAApB,EAA6B,mBAA7B,EAAkD,YAAU;AAC3DoC,IAAAA,CAAC,CAAC,SAASA,CAAC,CAAE,IAAF,CAAD,CAAUxE,IAAV,CAAe,QAAf,CAAT,GAAoC,WAArC,CAAD,CAAoDiC,MAApD;AACA,GAFD;AAGD,CAlND;AAoNA,IAAIwE,eAAe,GAAG,KAAtB","sourcesContent":["function pprf_resize_iframe(obj) {\r\n\tobj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';\r\n\r\n}\r\n\r\nfunction pprf_update_iframe_size( x, y ){\r\n\t\r\n\tif ( x != '' ) {\r\n\t\tjQuery('#' + x).height( jQuery('#' + x).height() ).animate({height: y}, 500);\r\n\t}\r\n}\r\nfunction pprf_update_size( x ){\r\n\t\r\n\tif ( x != '' ) {\r\n\t\tvar pprf_original_height = jQuery( x + ' html #wpbody-content').height() + 60;\r\n\t\r\n\t\tjQuery('#' + x).height( jQuery('#' + x).height() ).animate({height: pprf_original_height }, 500);;\r\n\r\n\t}\r\n}\r\n\r\nfunction pprf_update_parent_iframe( x ){\r\n\t\r\n\tif ( x != '') {\r\n\t\t\r\n\t\tvar y = jQuery('#' + x + ' html #wpbody-content').height();\r\n\t\t// 4px is the small gap at the bottom\r\n\t\tjQuery('#' + x).height( jQuery('#' + x).height() ).animate({height: y }, 500);\r\n\r\n\t}\r\n}\r\nvar pprf_parent_height = jQuery('html').height();\r\n/**\r\n * insert a new row to the page after adding a new item\r\n */\r\nfunction pprf_new( podid, postid, cpodid, authorid , iframeid, poditemid, parent_name ){ \r\n\tif( jQuery.isNumeric( podid ) && jQuery.isNumeric( cpodid ) && jQuery.isNumeric( authorid ) && jQuery.isNumeric( poditemid ) ) {\r\n\t\t\r\n\t\tvar para_obj = { 'podid': podid, 'postid': postid, 'cpodid': cpodid, 'authorid': authorid, 'poditemid' : poditemid, 'action' : 'admin_pprf_load_newly_added', 'security' : ajax_script.nonce };\r\n\t\r\n\t\tvar data_obj = para_obj;\r\n\t\t\r\n\t\tjQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-' + 'loader' ).removeClass('hidden');\t\t\t\r\n\t\tjQuery.post(\r\n\t\t\tajax_script.ajaxurl, \r\n\t\t\tdata_obj, \r\n\t\t\tfunction( responses ){\t\r\n\t\t\t\tjQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-' + 'loader' ).addClass('hidden');\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tvar response_data = responses['data'];\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t//console.log( response_data );\r\n\t\t\t\tif( responses['success'] === true && typeof response_data['id'] !== 'undefined' && jQuery.isNumeric( response_data['id'] ) ){\r\n\r\n\t\t\t\t\tvar\tiframe_build\t\t= pprf_build_item_html( response_data, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name, false );\r\n\t\t\t\t\t\r\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list' ).append( iframe_build ); \r\n\t\t\t\t\t// if entries limit, toggle the add new \r\n\t\t\t\t\tvar items_left_count\t= jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li').length;\r\n\t\t\t\t\tvar limit_int\t=\tparseInt( jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-entry-limit' ).val() );\r\n\t\t\t\t\tif( limit_int != 0 && items_left_count >= limit_int ){\r\n\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new' ).addClass('hidden');\t\t\t\t\t\t\t\r\n\t\t\t\t\t}\t\t\t\t\t\t\r\n\r\n\t\t\t\t}\r\n\t\t\t\t// if add a new one, activeate the live items tab\r\n\t\t\t\tjQuery( '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab .dashicons-portfolio').click();\t\r\n\t\t\t\t//jQuery( document ).on('click', '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab .dashicons-portfolio' );\r\n\t\t\t\t\r\n\t\t\t\tpprf_odd_even_color( cpodid + '-' + poditemid );\r\n\t\t\t}\r\n\t\t);\t\r\n\t}\r\n}\r\n\r\nfunction pprf_build_item_html( items, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name, is_repeated ){\r\n\tif( typeof items['id'] == 'undefined' || !jQuery.isNumeric( items['id'] ) || !jQuery.isNumeric( podid ) ){\r\n\t\treturn '';\r\n\t}\r\n//console.log(items);\r\n\tvar trashed_css\t\t= '';\r\n\tvar btn_trashed_css\t= 'pprf-btn-delete';\r\n\tvar display_style\t= '';\r\n\tvar edit_icon_css\t= 'dashicons-edit';\r\n\r\n\tif( jQuery('#panda-repeater-trash-info-' + cpodid + '-' + poditemid ).data('enable-trash') == 1 ){\t\t\r\n\t\tif( typeof items['trashed'] != 'undefined' && items['trashed'] == 1 ){\r\n\t\t\t\r\n\t\t\ttrashed_css \t= 'pprf-trashed';\r\n\t\t\tbtn_trashed_css\t= 'pprf-btn-trashed';\r\n\t\t\t// if the portfolio foder is open, hide the trash one\r\n\t\t\tedit_icon_css\t= 'dashicons-update ';\t\r\n\t\t\tif( jQuery('#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab.active .dashicons').hasClass('dashicons-portfolio') ) {\r\n\t\t\t\tdisplay_style\t\t= 'display:none;';\r\n\t\t\t}\t\t\r\n\t\t\t\t\r\n\t\t} else {\r\n\t\t\ttrashed_css\t\t= 'pprf-not-trashed';\r\n\t\t\tbtn_trashed_css\t= 'pprf-btn-not-trashed';\r\n\t\t\tif( jQuery('#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab.active .dashicons').hasClass('dashicons-trash') ) {\r\n\t\t\t\tdisplay_style\t\t= 'display:none;';\r\n\t\t\t}\t\t\t\t\r\n\t\t}\r\n\t}\t\r\n\tvar repeated_css_append\t=\t'';\r\n\tif( is_repeated == true ){\r\n\t\trepeated_css_append\t=\t'-repeated';\r\n\t}\r\n\tvar delete_action \t= '';//jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-' + 'add-new .pprf-trash-btn' ).data('target');\r\n\tvar ids_in_css\t \t= cpodid + '-' + items['id'] + '-' + poditemid;\r\n\tvar responding_id \t= items['id'];\r\n\tvar the_title\t \t= items['title'];\r\n\tvar the_label\t\t= the_title;\r\n\t//var the_label\t\t= '<strong>ID:</strong> ' + responding_id + ' <strong>' + items['pprf_name_label'] + ': </strong> ' + the_title;\r\n\tif( typeof items['label'] != 'undefined' && items['label'] != '' ){\r\n\t\tthe_label\t=\titems['label'];\r\n\t}\r\n\tvar next_background_css\t= jQuery('#next-bg').data('bg');\r\n\tvar full_url\t \t\t= PANDA_PODS_REPEATER_PAGE_URL[0] + 'iframe_id=panda-repeater-edit-' + ids_in_css + '&podid=' + podid + '&tb=' + cpodid + '&postid=' + postid + '&itemid=' + responding_id + '&poditemid=' + poditemid;\t\r\n\tvar html_build \t\t=\t\r\n\t '<li data-id=\"' + responding_id + '\" class=\"' + trashed_css + '\" id=\"li-' + ids_in_css + repeated_css_append + '\" style=\"' + display_style + '\">' +\r\n\t\t'<div class=\"pprf-row w100 pprf-left\">' + \r\n\t\t\t'<div class=\"w100 pprf-left\" id=\"pprf-row-brief-' + ids_in_css + repeated_css_append + '\">' +\r\n\t\t\t\t'<div class=\"pprf-left pd8 pprf-left-col ' + next_background_css + ' \">' + the_label + '</div>';\r\n\r\n\tif( is_repeated == true ){\r\n\t\t\thtml_build +=\t\r\n\t\t\t\t\t\t'<div class=\"button pprf-right-col center pprf-dismiss-btn ' + delete_action + ' ' + btn_trashed_css + '\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' + \r\n\t\t\t\t\t\t\t'<span class=\"dashicons dashicons-dismiss pdt6 mgb0 \"></span>' +\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t'</div>' +\t\r\n\t\t\t\t\t\t'<div class=\"pprf-left pd8\">Repeated</div>';\t\t\t\r\n\t} else {\r\n\t\thtml_build +=\t\t\t\t\r\n\t\t\t\t'<div class=\"button pprf-right-col center pprf-trash-btn ' + delete_action + ' ' + btn_trashed_css + '\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' + \r\n\t\t\t\t\t'<span class=\"dashicons dashicons-trash pdt6 mgb0 \"></span>' +\r\n\t\t\t\t\t'<div id=\"panda-repeater-trash-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\r\n\t\t\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_URL[0] + '/images/dots-loading.gif\" alt=\"loading\" class=\"mgl8 loading pprf-left\"/>' +\r\n\t\t\t\t\t'</div>' +\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t'</div>' +\t\r\n\t\t\t\t'<div class=\"button pprf-right-col center pprf-save-btn\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' +\r\n\t\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_URL[0] + 'images/save-icon-tran.png\" class=\"pprf-save-icon mgt8 mgb2\"/>' + \t\r\n\t\t\t\t\t'<div id=\"panda-repeater-save-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\r\n\t\t\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_URL[0] + 'images/dots-loading.gif\" alt=\"loading\" class=\"mgl8 pprf-left\"/>' +\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t'</div>' +\r\n\t\t\t\t'</div>' +\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t'<div class=\"button pprf-edit pprf-row-load-iframe alignright pprf-right-col center pprf-edit-btn\" role=\"button\" data-target=\"' + ids_in_css + '\" data-url=\"' + full_url + '\">' +\r\n\t\t\t\t\t'<span class=\"dashicons ' + edit_icon_css + ' pdt8 mgb0 pprf-edit-span\"></span>' +\r\n\t\t\t\t\t'<div id=\"panda-repeater-edit-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\r\n\t\t\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_URL[0] + '/images/dots-loading.gif\" alt=\"loading\" class=\"mgl9 pprf-left\"/>' +\r\n\t\t\t\t\t'</div>\t' +\r\n\t\t\t\t'</div>';\r\n\t}\r\n\thtml_build +=\t\t\t\t\t\t\t\t\r\n\t\t\t'</div>' +\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t'<div>' + \r\n\t\t\t\t'<iframe id=\"panda-repeater-edit-' + ids_in_css + '\" frameborder=\"0\" scrolling=\"no\" src=\"\" style=\"display:none; \" class=\"panda-repeater-iframe w100\"></iframe>' + \r\n\t\t\t\t'<div id=\"panda-repeater-edit-expand-' + ids_in_css + '\" class=\"w100 pprf-left center pdt3 pdb3 pprf-expand-bar pprf-edit-expand\" data-target=\"' + ids_in_css + '\" style=\"display:none;\">Content missing? Click here to expand</div>' + \r\n\t\t\t'</div>' +\r\n\t \t '</div>' +\r\n\t\t'</li>'\r\n\t ;\r\n\tif( next_background_css == 'pprf-purple-bg' ){\r\n\t\tjQuery('#next-bg').data('bg', 'pprf-white-bg');\r\n\t} else {\r\n\t\tjQuery('#next-bg').data('bg', 'pprf-purple-bg');\t\t\t\t\t\t\r\n\t}\t \r\n\treturn html_build; \r\n}\r\n/**\r\n * delete an item\r\n */\r\nfunction pprf_delete_item( podid, postid, cpodid, itemid, authorid , iframeid, poditemid, trashed ){\r\n\t\r\n\tif( jQuery.isNumeric( podid ) && jQuery.isNumeric( cpodid ) && jQuery.isNumeric( authorid ) && jQuery.isNumeric( itemid ) && jQuery.isNumeric( poditemid ) ) {\r\n\t\t\r\n\t\tvar para_obj \t= { 'podid': podid, 'postid': postid, 'cpodid': cpodid, 'itemid' : itemid, 'authorid': authorid, 'poditemid' : poditemid, 'action' : 'admin_pprf_delete_item', 'trash' : trashed, 'security' : ajax_script.nonce };\r\n\t\tvar info_text\t=\t'';\r\n\t\tif( trashed == 0 ){\r\n\t\t\tinfo_text\t=\tstrs_obj.be_restored;\r\n\t\t}\t\t\r\n\t\tif( trashed == 1 ){\r\n\t\t\tinfo_text\t=\tstrs_obj.can_recover;\r\n\t\t}\r\n\t\tif( trashed == 2 ){\r\n\t\t\tinfo_text\t=\tstrs_obj.be_deleted;\r\n\t\t}\r\n\t\t//panda-repeater-edit-13-506 236\r\n\t\tvar data_obj = para_obj;\r\n\t\tvar passt_bln = confirm( strs_obj.you_sure + ' ' + info_text );\r\n\t\t//$('#overlord').removeClass('hidden');\t\t\r\n\t\t\r\n\t\tif( passt_bln == true ){\r\n\r\n\t\t\tif( trashed == 0 ){\r\n\t\t\t\tjQuery( '#panda-repeater-edit-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).removeClass('hidden');\r\n\t\t\t} else {\t\t\t\t \r\n\t\t\t\tjQuery( '#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).removeClass('hidden');\r\n\t\t\t}\r\n\t\t\t//jQuery( '#pprf-row-brief-' + cpodid + '-' + itemid + '-' + poditemid + ' .pprf-trash-btn .dashicons-trash' ).remove( );\r\n\t\t\tjQuery.post(\r\n\t\t\t\tajax_script.ajaxurl, \r\n\t\t\t\tdata_obj, \r\n\t\t\t\tfunction( responses ){\t\r\n\t\t\t\t\tif( responses['success'] === true ){\r\n\t\t\t\t\t\tvar response_data = responses['data'];\r\n\t\t\t\t\t\tif( response_data.length != 0 ){\r\n\t\t\t\t\t\t\tvar ids_in_css\t=\tcpodid + '-' + itemid + '-' + poditemid;\r\n\t\t\t\t\t\t\tvar exp_str\t\t= 'panda-repeater-edit-expand-' + ids_in_css;\r\n\t\t\t\t\t\t\tvar iframe_build \t= 'panda-repeater-edit-' + ids_in_css;\t\t\r\n\r\n\t\t\t\t\t\t\tif( trashed == 0 ){\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-edit-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).addClass('hidden');\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).addClass('hidden');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t//jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' #' + iframeid ).remove( );\r\n\t\t\t\t\t\t\tif( trashed == 0 ){\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span').removeClass('dashicons-update');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span').addClass('dashicons-edit')\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).removeClass('pprf-trashed');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).addClass('pprf-not-trashed');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).css('display', 'none');\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn').addClass('pprf-btn-not-trashed');\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn').removeClass('pprf-btn-trashed');\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif( jQuery.trim( jQuery('#' + iframe_build ).contents().find(\"body\").html() ) != '' ) {\r\n\t\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-save-btn .pprf-save-icon').attr('src', PANDA_PODS_REPEATER_URL[0] + 'images/save-icon.png');\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif( trashed == 1 ){\r\n\r\n\r\n\t\t\t\t\t\t\t\tif( jQuery('#' + iframe_build ) != 'undefined' ){\r\n\t\t\t\t\t\t\t\t\tjQuery('#' + iframe_build ).hide();\t\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif( jQuery('#' + exp_str ) != 'undefined' ){\r\n\t\t\t\t\t\t\t\t\tjQuery('#' + exp_str ).hide();\t\r\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tjQuery('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).removeClass('dashicons-arrow-up');\r\n\t\t\t\t\t\t\t\tjQuery('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).addClass('dashicons-edit');\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).removeClass('pprf-not-trashed');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).addClass('pprf-trashed');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).css('display', 'none');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).addClass('dashicons-update');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).removeClass('dashicons-edit');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn').addClass('pprf-btn-trashed');\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn').removeClass('pprf-btn-not-trashed');\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-save-btn .pprf-save-icon').attr('src', PANDA_PODS_REPEATER_URL[0] + 'images/save-icon-tran.png');\r\n\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif( trashed == 2 ){\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' #' + iframeid ).parent().parent().remove( );\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).remove( );\r\n\t\t\t\t\t\t\t\t// if entries limit, toggle the add new \r\n\t\t\t\t\t\t\t\tvar items_left_count\t= jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li').length;\r\n\t\t\t\t\t\t\t\tvar limit_int\t=\tparseInt( jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-entry-limit' ).val() );\r\n\t\t\t\t\t\t\t\tif( limit_int != 0 && items_left_count < limit_int ){\r\n\t\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new' ).removeClass('hidden');\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// integrate with simpods js\r\n\t\t\t\t\t\t\t\tif( typeof call_simpods !== 'undefined' && jQuery.isFunction( call_simpods ) ) {\r\n\t\t\t\t\t\t\t\t\tcall_simpods( responses );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t//document.getElementById( iframeid ).contentWindow.pprf_resize_window() ;\r\n\t\t\t\t\t\t\t pprf_odd_even_color( cpodid + '-' + poditemid );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t);\t\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n}\r\n//jQuery('.pprf-redorder-btn').click( function(){\r\njQuery( document ).on('click', '.pprf-redorder-btn',\tfunction( evt ){\t\t\r\n\tvar id = jQuery( this ).data('id');\r\n\tjQuery( this ).addClass('hidden');\t\r\n\tjQuery( this ).parent().children('.pprf-save-redorder-btn').removeClass('hidden');\t\r\n\tjQuery( this ).parent().children('.pprf-redorder-list-wrap').removeClass('hidden');\r\n\tjQuery( this ).parent().children('.pprf-row').addClass('hidden');\t\r\n\tjQuery( '#' + id + '-add-new' ).addClass('hidden');\t\r\n});\r\n\r\n//jQuery('.pprf-save-redorder-btn').click( function(){\r\njQuery( document ).on('click', '.pprf-save-redorder-btn',\tfunction( evt ){\t\r\n\tvar id = jQuery( this ).data('id');\r\n\tjQuery( this ).addClass('hidden');\t\r\n\tjQuery( this ).parent().children('.pprf-redorder-list-wrap').addClass('hidden');\t\r\n\tjQuery( this ).parent().children('.pprf-save-redorder-btn').addClass('hidden');\r\n\tjQuery( this ).parent().children('.pprf-redorder-btn').removeClass('hidden');\r\n\tjQuery( this ).parent().children('.pprf-row').removeClass('hidden');\t\r\n\tjQuery( '#' + id + '-add-new' ).removeClass('hidden');\t\r\n});\r\n /**\r\n * load more\r\n */\r\n//jQuery('.pprf-load-more-btn').click( function( evt ){\r\njQuery( document ).on('click', '.pprf-load-more-btn',\tfunction( evt ){\r\n\tevt.preventDefault();\r\n\tjQuery( '#pprf-load-more-wrap-' + jQuery( this ).data('target') + ' .pprf-ajax-img').css('display', 'block');\r\n\t\r\n\r\n\tpprf_load_more( jQuery( this).data('target'), jQuery( this ) );\r\n\r\n})\t \r\n\r\nfunction pprf_load_more( target_str, ele_obj ){\r\n\tvar loaded_arr\t=\tnew Array();\r\n\tjQuery( '#panda-repeater-fields-' + target_str + ' .pprf-redorder-list li' ).each( function( idx_int ) {\r\n\t\tloaded_arr[ idx_int ] = parseInt( jQuery( this ).data('id') );\r\n\t});\r\n\t\r\n\tvar data_obj = {\r\n\t\taction \t\t: \t'admin_pprf_load_more',\r\n\t\tloaded \t\t:\tloaded_arr, \r\n\t\tsecurity \t: \tajax_script.nonce,\r\n\t\tpod_id\t\t: \tele_obj.data('podid'),\r\n\t\tpost_id\t\t: \tele_obj.data('postid'),\r\n\t\tsaved_tb\t: \tele_obj.data('tb'),\r\n\t\tiframe_id \t: \tele_obj.data('iframe_id'),\r\n\t\tpod_item_id\t: \tele_obj.data('poditemid'),\r\n\t\tauthorid\t: \tele_obj.data('userid'),\r\n\t\tcp_title\t: \tele_obj.data('cptitle'),\r\n\t\ttrashable\t: \tele_obj.data('enable-trash'),\r\n\t\torder\t\t: \tele_obj.data('order'),\r\n\t\torder_by\t: \tele_obj.data('order-by'),\r\n\t\tamount\t\t: \tjQuery('#panda-repeater-amount-' + target_str ).val(),\r\n\t\tstart\t\t: \tjQuery('#panda-repeater-start-from-' + target_str ).val()\r\n\t};\r\n\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-load-more-report' ).text( '' );\r\n\tjQuery.post(\r\n\t\tajax_script.ajaxurl, \r\n\t\tdata_obj, \r\n\t\tfunction( response_obj ){\r\n\t\t\tvar html_build\t=\t'';\r\n\t\t\tif( response_obj.success == true ){\r\n\t\t\t\tvar trashed_count\t\t=\t0;\r\n\t\t\t\t//var not_trashed_count\t=\t0;\r\n\t\t\t\tfor( var i = 0; i < response_obj.data.length; i ++ ){\t\r\n\t\t\t\t\tvar is_repeated\t=\tfalse;\r\n\r\n\t\t\t\t\tif( jQuery( '#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load' ).val() == 'append_to' ){ // only need to check repeatition if it is on Append To.\r\n\t\t\t\t\t\tfor( var j = 0; j < loaded_arr.length; j ++ ){\t//inArry doesn't work\r\n\t\t\t\t\t\t\tif( parseInt( response_obj.data[ i ]['id'] ) == loaded_arr[ j ] ){\r\n\t\t\t\t\t\t\t\tis_repeated\t=\ttrue;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\r\n\t\t\t\t\thtml_build += pprf_build_item_html( response_obj.data[ i ], data_obj.pod_id, data_obj.post_id, data_obj.saved_tb, data_obj.authorid , data_obj.iframe_id, data_obj.pod_item_id, data_obj.cp_title, is_repeated )\r\n\t\t\t\t\tif( response_obj.data[ i ]['trashed'] == 1 ){\r\n\t\t\t\t\t\ttrashed_count ++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tvar info_text\t=\tresponse_obj.data.length;\r\n\t\t\t\tif( data_obj.trashable == 1 ){\r\n\t\t\t\t\tinfo_text\t=\t( parseInt( response_obj.data.length ) - trashed_count ) + ' published, ' + trashed_count + ' trashed.';\r\n\t\t\t\t}\r\n\t\t\t\tif( jQuery( '#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load' ).val() == 'append_to' ){\r\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + data_obj.saved_tb + '-' + data_obj.pod_item_id + ' .pprf-redorder-list' ).append( html_build ); \r\n\t\t\t\t} else {\r\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + data_obj.saved_tb + '-' + data_obj.pod_item_id + ' .pprf-redorder-list' ).html( html_build ); \r\n\t\t\t\t}\r\n\t\t\t\tpprf_odd_even_color( data_obj.saved_tb + '-' + data_obj.pod_item_id );\r\n\t\t\t\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-ajax-img').css('display', 'none');\r\n\r\n\t\t\t\tif( response_obj.data.length != 0 ){\r\n\t\t\t\t\tjQuery('#panda-repeater-start-from-' + target_str ).val( parseInt( data_obj.start ) + parseInt( response_obj.data.length ) );\r\n\t\t\t\t}\r\n\r\n\t\t\t\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-load-more-report' ).text( ' | Loaded ' + info_text );\r\n\t\t\t}\r\n\r\n\t\t\t//pprf_build_item_html( items, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name )\r\n\t\t\t//pprf_new( ele_obj.data('podid'), ele_obj.data('postid'), ele_obj.data('tb'), ele_obj.data('userid'), ele_obj.data('iframe_id'), ele_obj.data('pod_item_id'), ele_obj.data('cptitle') );\r\n\r\n\t\t}\r\n\t);\r\n}\t\r\n/**\r\n * reset colours for each row\r\n */\r\n\r\nfunction pprf_odd_even_color( ids ){\r\n\r\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col').removeClass('pprf-purple-bg');\r\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col').removeClass('pprf-white-bg');\r\n\t\r\n\tif( jQuery( '#panda-repeater-fields-tabs-' + ids ).length == 0 ){\r\n\t\t\r\n\t\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col').each( function( idx ) {\r\n\t\t\tif( idx % 2 == 0 ){\r\n\t\t\t\tjQuery( this ).addClass('pprf-white-bg');\r\n\t\t\t} else {\r\n\t\t\t\tjQuery( this ).addClass('pprf-purple-bg');\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-not-trashed').each( function( idx ) {\r\n\t\tif( idx % 2 == 0 ){\r\n\t\t\tjQuery( this ).children('.pprf-row').children().children('.pprf-left-col').addClass('pprf-white-bg');\r\n\t\t} else {\r\n\t\t\tjQuery( this ).children('.pprf-row').children().children('.pprf-left-col').addClass('pprf-purple-bg');\r\n\t\t}\r\n\t});\r\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-trashed').each( function( idx ) {\r\n\t\tif( idx % 2 == 0 ){\r\n\t\t\tjQuery( this ).children('.pprf-row').children().children('.pprf-left-col').addClass('pprf-white-bg');\r\n\t\t} else {\r\n\t\t\tjQuery( this ).children('.pprf-row').children().children('.pprf-left-col').addClass('pprf-purple-bg');\r\n\t\t}\r\n\t});\t\r\n}\r\n/**\r\n * if reassigned successfully, remove the item and reset colours\r\n */\r\nfunction pprf_reassign( cpodid, poditemid, itemid ){\r\n\t//console.log( cpodid, poditemid, itemid );\r\n\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).remove( );\r\n\t//document.getElementById( iframeid ).contentWindow.pprf_resize_window() ;\r\n\tpprf_odd_even_color( cpodid + '-' + poditemid );\r\n}\r\njQuery(document).ready( function($) {\r\n\t\t\r\n\t/**\r\n\t * fix_helper_modified for drag and drop\r\n\t */\r\n\tvar fix_helper_modified = function(e, tr) {\r\n\t\tvar $originals = tr.children();\r\n\t\tvar $helper = tr.clone();\r\n\t\t$helper.children().each(function(index) {\r\n\t\t\t$(this).width($originals.eq(index).width());\t\t\t\t\t\r\n\t\t});\r\n\t\t\r\n\t\treturn $helper;\r\n\t},\r\n\tupdate_index = function(e, ui) {\r\n\t\tvar the_order = $(this).sortable('toArray');\r\n\r\n\t\tvar data_obj = {\r\n\t\t\taction: 'admin_pprf_update_order',\r\n\t\t\torder: \t the_order, \r\n\t\t\tsecurity : ajax_script.nonce\r\n\t\t};\r\n\r\n\t\t$.post(\r\n\t\t\tajax_script.ajaxurl, \r\n\t\t\tdata_obj, \r\n\t\t\tfunction( resp_arr ){\t\t\t\t\r\n\t\t\t\tpprf_odd_even_color( resp_arr.data.pprf_id );\r\n\t\t\t}\r\n\t\t)\t\t\t\t\r\n\t};\t\r\n\r\n\tif( $('.pprf-redorder-list.pandarf_order').length != 0 ){\r\n\t\t$('.pprf-redorder-list.pandarf_order').sortable({\r\n\t\t\thelper: fix_helper_modified,\r\n\t\t\tcursor: 'move',\r\n\t\t\topacity: 0.7,\r\n\t\t\ttolerance: 'intersect',\t\t\r\n\t\t\tupdate: \t\tupdate_index,\r\n\t\t\tcancel: \t\t'.pprf-row-load-iframe, .pprf-save-btn, pprf-trash-btn',\r\n\t\t\thandle: \t\t'.pprf-left-col'\r\n\t\t});\t\t\r\n\t}\r\n\r\n\t$(document.body).on('click', '.pprf-row-load-iframe', function( e ){\t\r\n\t\te.stopPropagation();\r\n\t\tvar url_str \t= $( this ).data('url');\r\n\t\tvar ids_in_css\t \t= $( this ).data('target');\r\n\t\tvar exp_str\t\t= 'panda-repeater-edit-expand-' + ids_in_css;\r\n\t\tvar iframe_build \t= 'panda-repeater-edit-' + ids_in_css;\t\t\r\n\t\tvar trash_ele\t= $( this ).parent().children('.pprf-trash-btn');\r\n\t\tif( $( this ).children('.pprf-edit-span').hasClass('dashicons-update') ){ \r\n\t\t\t// restore this item\t\t\r\n\t\t\tpprf_delete_item( trash_ele.data('podid'), trash_ele.data('postid'), trash_ele.data('tb'), trash_ele.data('itemid'), trash_ele.data('userid'), trash_ele.data('iframe_id'), trash_ele.data('poditemid'), 0 );\r\n\t\t} else { \r\n\t\t\tvar addEdit_str\t= ' .pprf-edit';\t\r\n\t\t\tif( $( this ).hasClass('pprf-add') ){\r\n\t\t\t\taddEdit_str\t= '.pprf-add';\t\r\n\t\t\t\tiframe_build \t= 'panda-repeater-add-new-' + ids_in_css;\r\n\t\t\t\texp_str\t\t= 'panda-repeater-add-new-expand-' + ids_in_css;\r\n\t\t\t}\t\r\n\t\t\t\r\n\t\t\tif( $('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass('dashicons-edit') ){\t\t\r\n\t\t\t\t\r\n\t\t\t\t//if iframe not loaded\r\n\t\t\t\t\r\n\t\t\t\tif( $('#' + iframe_build ).attr('src') == '' ){\r\n\t\t\t\t\t$('#' + iframe_build ).attr('src', url_str ); \r\n\t\t\t\t\t$('#' + iframe_build + '-' + 'loader' ).removeClass('hidden');\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$('#' + iframe_build ).show('slow',function(){\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).addClass('dashicons-arrow-up');\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).removeClass('dashicons-edit');\t\t\r\n\t\t\t\t});\r\n\t\t\t\t$('#' + exp_str ).show();\t\r\n\t\t\t\t$('#' + iframe_build ).on('load', function(){\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('#' + iframe_build + '-' + 'loader' ).addClass('hidden');\t\r\n\t\t\t\t\t//change icon\t\r\n\t\t\t\t\t$('#panda-repeater-save-' + ids_in_css + '-' + 'loader' ).parent().children('.pprf-save-icon').attr('src', PANDA_PODS_REPEATER_URL[0] + '/images/save-icon.png');\r\n\t\t\t\t\t$('#panda-repeater-save-' + ids_in_css + '-' + 'loader' ).parent().addClass('pprf-btn-ready');\r\n\t\t\t\t\t$('#panda-repeater-save-' + ids_in_css + '-' + 'loader' ).addClass('hidden');\r\n\t\t\t\t\t//$('#pprf-row-brief-' + ids_in_css + '' ).addClass('hidden');\t\r\n\t\t\t\t\t//$('#' + iframe_build )[0].contentWindow.pprf_resize_window();\r\n\t\t\t\t\t//console.log( $(this).parent().height() );\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).addClass('dashicons-arrow-up');\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).removeClass('dashicons-edit');\t\t\t\t\t\t\r\n\t\t\t\t});\t\r\n\t\t\t//\tif( $('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass('dashicons') ){\t\r\n\r\n\t\t\t\t//}\r\n\t\t\t} else {\r\n\t\t\t\t\r\n\t\t\t\t$('#' + iframe_build ).hide('slow',function(){\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).removeClass('dashicons-arrow-up');\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).addClass('dashicons-edit');\t\r\n\t\t\t\t});\t\r\n\t\t\t\t$('#' + exp_str ).hide();\t\t\t\t\t\r\n\t\t\t//\tif( $('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass('dashicons') ){\t\r\n\t\t\t\t\t\t\r\n\t\t\t//\t}\r\n\t\t\t}\r\n\t\t\t$('#pprf-row-brief-' + ids_in_css + ' .dashicons-trash' ).removeClass('dashicons-arrow-up');\r\n\t\t}\r\n\t\t\r\n\t});\t\r\n\t/**\r\n\t * click to explan its iframe\r\n\t */\t\r\n\t$( document.body ).on('click', '.pprf-expand-bar', function(){\t\t\t\t\r\n\t\tvar ids\t \t= $( this ).data('target');\r\n\t\tvar iframe \t= 'panda-repeater-edit-' + ids;\r\n\t\tif( $( this ).hasClass('pprf-add-expand') ){\r\n\t\t\tiframe \t= 'panda-repeater-add-new-' + ids;\t\t\t\r\n\t\t}\t\r\n\t\tif( typeof document.getElementById( iframe ) != 'undefined' ){\r\n\t\t\t\r\n\t\t\tif( typeof document.getElementById( iframe ).contentWindow.pprf_resize_window != 'undefined' ){ \r\n\t\t\t\tdocument.getElementById( iframe ).contentWindow.pprf_resize_window();\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\t/**\r\n\t * click to delete\r\n\t */\t \r\n\t$( document.body ).on('click', '.pprf-trash-btn', function( e ){\t\t\r\n\t\te.stopPropagation();\r\n\t\tvar ids\t \t= $( this ).data('target');\r\n\t\tvar iframe \t= 'panda-repeater-edit-' + ids;\r\n\t\tif( $( this ).hasClass('pprf-add-expand') ){\r\n\t\t\tiframe \t= 'panda-repeater-add-new-' + ids;\t\t\t\r\n\t\t}\t\r\n\t\tvar trash\t= 0;\r\n\t\tif( $( this ).hasClass('pprf-btn-not-trashed') ){\r\n\t\t\ttrash\t= 1;\r\n\t\t}\r\n\t\tif( $( this ).hasClass('pprf-btn-trashed') ){\r\n\t\t\ttrash\t= 2;\r\n\t\t}\t\r\n\t\tif( $( this ).hasClass('pprf-btn-delete') ){\r\n\t\t\ttrash\t= 2;\r\n\t\t}\t\t\t\t\t\t\r\n\t\tpprf_delete_item( $( this ).data('podid'), $( this ).data('postid'), $( this ).data('tb'), $( this ).data('itemid'), $( this ).data('userid'), $( this ).data('iframe_id'), $( this ).data('poditemid'), trash );\r\n\t })\r\n\t \t \r\n\t$(document.body).on('click', '.pprf-save-btn', function( e ){\t\t\r\n\t\t e.stopPropagation();\t\r\n\t\t if( $( this ).hasClass( 'pprf-btn-ready' ) ){\r\n\t\t\tvar ids\t\t= $( this ).data('target');\r\n\t\t\tvar iframe \t= 'panda-repeater-edit-' + ids;\r\n\t\t\tif( $( this ).hasClass('pprf-save-new-btn') ){\r\n\t\t\t\tiframe \t= 'panda-repeater-add-new-' + ids;\r\n\t\t\t}\t\t\t \r\n\t\t\t$('#panda-repeater-save-' + ids + '-loader' ).removeClass('hidden');\r\n\t\t\t\r\n\t\t\t$('#' + iframe ).contents().find('.pods-submit-button').trigger( \"click\" );\t\r\n\t\t\tpprf_is_changed\t=\tfalse;\t\t\r\n\r\n\t\t }\r\n\t });\r\n\t /**\r\n\t * if a pods is is clicked, flag it as saved\r\n\t */\r\n\t $('.toplevel_page_panda-pods-repeater-field .pods-field-input').on('click keyup change', function(){\r\n\t\t pprf_is_changed\t=\ttrue;\r\n\t });\r\n\r\n\r\n\t$( document ).on('click', '#publishing-action .button, #save-action .button', function(){\t\t\t\t\r\n\t\t if( pprf_is_changed ){\r\n\t\t\tevt.preventDefault();\r\n\t\t\tvar leave = confirm( strs_obj.Ignore_changes );\r\n\t\t\tif ( leave == true){\r\n\t\t\t\tpprf_is_changed\t=\tfalse;\r\n\t\t\t\t//$( this ).click();\r\n\t\t\t\t$( this ).trigger('click');\r\n\t\t\t} \r\n\t\t\tif ( leave == false){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t }\r\n\t });\r\n\r\n\t /**\r\n\t * toggle trashed and current\r\n\t */\t\r\n\t$(document.body).on('click', '.pprf-tab .dashicons-trash', function(){\t\t\t\r\n\t \t\r\n\t \t$( '#panda-repeater-fields-' + $( this).parent().data('target') + ' .pprf-trashed').css('display', 'block');\r\n\t \t$( '#panda-repeater-fields-' + $( this).parent().data('target') + ' .pprf-not-trashed').css('display', 'none');\r\n\t \t$( this ).parent().parent().children('.active').removeClass('active');\r\n\t \t$( this ).parent().addClass('active');\r\n\t \tpprf_odd_even_color( $( this).parent().data('target') );\r\n\r\n\t})\t\r\n\t$(document.body).on('click', '.pprf-tab .dashicons-portfolio', function(){\t\t\t\r\n\t \t$( '#panda-repeater-fields-' + $( this).parent().data('target') + ' .pprf-trashed').css('display', 'none');\r\n\t \t$( '#panda-repeater-fields-' + $( this).parent().data('target') + ' .pprf-not-trashed').css('display', 'block');\r\n\t \t$( this ).parent().parent().children('.active').removeClass('active');\r\n\t \t$( this ).parent().addClass('active');\t \t\r\n\t \tpprf_odd_even_color( $( this).parent().data('target') );\r\n\t})\t \r\n \r\n \t/**\r\n \t * remove repeated\r\n \t */ \t\r\n \t$(document.body).on('click', '.pprf-dismiss-btn', function(){\t\r\n \t\t$('#li-' + $( this ).data('target') + '-repeated' ).remove();\r\n \t})\r\n});\r\n \r\nvar pprf_is_changed\t=\tfalse;\t"],"file":"admin.js"}1 {"version":3,"sources":["admin.js"],"names":["pprf_resize_iframe","obj","style","height","contentWindow","document","body","scrollHeight","pprf_update_iframe_size","x","y","jQuery","animate","pprf_update_size","pprf_original_height","pprf_update_parent_iframe","pprf_parent_height","pprf_new","podid","postid","cpodid","authorid","iframeid","poditemid","parent_name","isNaN","para_obj","ajax_script","nonce","data_obj","removeClass","post","ajaxurl","responses","addClass","response_data","iframe_build","pprf_build_item_html","append","items_left_count","length","limit_int","parseInt","val","click","pprf_odd_even_color","items","is_repeated","trashed_css","btn_trashed_css","display_style","edit_icon_css","data","hasClass","repeated_css_append","delete_action","ids_in_css","responding_id","the_title","the_label","next_background_css","full_url","PANDA_PODS_REPEATER_PAGE_URL","PANDA_PODS_REPEATER_CONSTANTS","html_build","url","pprf_delete_item","itemid","trashed","info_text","strs_obj","be_restored","can_recover","be_deleted","passed","confirm","you_sure","exp_str","css","trim","contents","find","html","attr","hide","parent","remove","call_simpods","isFunction","on","evt","id","children","preventDefault","pprf_load_more","target_str","ele_obj","loaded_arr","Array","each","idx_int","action","loaded","security","pod_id","post_id","saved_tb","iframe_id","pod_item_id","cp_title","trashable","order","order_by","amount","start","text","response_obj","success","trashed_count","data_length","loaded_length","i","j","ids","idx","pprf_reassign","ready","$","fix_helper_modified","e","tr","$originals","$helper","clone","index","width","eq","update_index","ui","the_order","sortable","resp_arr","pprf_id","helper","cursor","opacity","tolerance","update","cancel","handle","stopPropagation","url_str","trash_ele","addEdit_str","show","iframe","getElementById","pprf_resize_window","trash","trigger","pprf_is_changed","leave","Ignore_changes"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,kBAAT,CAA4BC,GAA5B,EAAiC;AAChCA,EAAAA,GAAG,CAACC,KAAJ,CAAUC,MAAV,GAAmBF,GAAG,CAACG,aAAJ,CAAkBC,QAAlB,CAA2BC,IAA3B,CAAgCC,YAAhC,GAA+C,IAAlE;AAEA;;AAED,SAASC,uBAAT,CAAkCC,CAAlC,EAAqCC,CAArC,EAAwC;AAEvC,MAAKD,CAAC,IAAI,EAAV,EAAe;AACdE,IAAAA,MAAM,CAAE,MAAMF,CAAR,CAAN,CAAkBN,MAAlB,CAA0BQ,MAAM,CAAE,MAAMF,CAAR,CAAN,CAAkBN,MAAlB,EAA1B,EAAuDS,OAAvD,CAAgE;AAACT,MAAAA,MAAM,EAAEO;AAAT,KAAhE,EAA6E,GAA7E;AACA;AACD;;AACD,SAASG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AC,CAAE,IAAF,CAAD,CAAU1C,MAAV,GAAmBA,MAAnB,GAA4BO,QAA5B,CAAsC,SAAtC,EAAkD9D,WAAlD,CAA+D,QAA/D;AACAiG,IAAAA,CAAC,CAAE,IAAF,CAAD,CAAU1C,MAAV,GAAmBnD,QAAnB,CAA6B,QAA7B;AACAW,IAAAA,mBAAmB,CAAEkF,CAAC,CAAE,IAAF,CAAD,CAAU1C,MAAV,GAAmBjC,IAAnB,CAAyB,QAAzB,CAAF,CAAnB;AACA,GATF;AAYA;AACF;AACA;;AACE2E,EAAAA,CAAC,CAAE1H,QAAQ,CAACC,IAAX,CAAD,CAAmBmF,EAAnB,CACC,OADD,EAEC,mBAFD,EAGC,YAAU;AACTsC,IAAAA,CAAC,CAAE,SAASA,CAAC,CAAE,IAAF,CAAD,CAAU3E,IAAV,CAAgB,QAAhB,CAAT,GAAsC,WAAxC,CAAD,CAAuDkC,MAAvD;AACA,GALF;AAOA,CAxPF;AA2PA,IAAI0E,eAAe,GAAG,KAAtB","sourcesContent":["/**\n * The JS file for the repeater field\n *\n * @package panda_pods_repeater_field\n * @author Dongjie Xu\n */\n\n/**\n * Collection for JS functions\n *\n * @package panda_pods_repeater_field\n * @author Dongjie Xu\n * @since 09/02/2016\n */\nfunction pprf_resize_iframe(obj) {\n\tobj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';\n\n}\n\nfunction pprf_update_iframe_size( x, y ){\n\n\tif ( x != '' ) {\n\t\tjQuery( '#' + x ).height( jQuery( '#' + x ).height() ).animate( {height: y}, 500 );\n\t}\n}\nfunction pprf_update_size( x ){\n\n\tif ( x != '' ) {\n\t\tvar pprf_original_height = jQuery( x + ' html #wpbody-content' ).height() + 60;\n\n\t\tjQuery( '#' + x ).height( jQuery( '#' + x ).height() ).animate( {height: pprf_original_height }, 500 );;\n\n\t}\n}\n\nfunction pprf_update_parent_iframe( x ){\n\n\tif ( x != '') {\n\n\t\tvar y = jQuery( '#' + x + ' html #wpbody-content' ).height();\n\t\t// 4px is the small gap at the bottom\n\t\tjQuery( '#' + x ).height( jQuery( '#' + x ).height() ).animate( {height: y }, 500 );\n\n\t}\n}\nvar pprf_parent_height = jQuery( 'html' ).height();\n/**\n * Insert a new row to the page after adding a new item.\n */\nfunction pprf_new( podid, postid, cpodid, authorid , iframeid, poditemid, parent_name ){\n\n\tif ( false === isNaN( podid ) && false === isNaN( cpodid ) && false === isNaN( authorid ) && false === isNaN( poditemid ) ) {\n\n\t\tvar para_obj = { 'podid': podid, 'postid': postid, 'cpodid': cpodid, 'authorid': authorid, 'poditemid' : poditemid, 'action' : 'admin_pprf_load_newly_added', 'security' : ajax_script.nonce };\n\n\t\tvar data_obj = para_obj;\n\n\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-loader' ).removeClass( 'hidden' );\n\t\tjQuery.post(\n\t\t\tajax_script.ajaxurl,\n\t\t\tdata_obj,\n\t\t\tfunction( responses ){\n\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-loader' ).addClass( 'hidden' );\n\n\t\t\t\tvar response_data = responses['data'];\n\n\t\t\t\tif ( responses['success'] === true && typeof response_data['id'] !== 'undefined' && false === isNaN( response_data['id'] ) ) {\n\n\t\t\t\t\tvar\tiframe_build = pprf_build_item_html( response_data, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name, false );\n\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list' ).append( iframe_build );\n\t\t\t\t\t// If entries limit, toggle the add new.\n\t\t\t\t\tvar items_left_count = jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li' ).length;\n\t\t\t\t\tvar limit_int = parseInt( jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-entry-limit' ).val() );\n\t\t\t\t\tif ( limit_int != 0 && items_left_count >= limit_int ) {\n\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new' ).addClass( 'hidden' );\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t// If add a new one, activeate the live items tab.\n\t\t\t\tjQuery( '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab .dashicons-portfolio' ).click();\n\n\t\t\t\tpprf_odd_even_color( cpodid + '-' + poditemid );\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction pprf_build_item_html( items, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name, is_repeated ){\n\tif ( typeof items['id'] == 'undefined' || true === isNaN( items['id'] ) || true === isNaN( podid ) ) {\n\t\treturn '';\n\t}\n\tvar trashed_css\t\t= '';\n\tvar btn_trashed_css\t= 'pprf-btn-delete';\n\tvar display_style\t= '';\n\tvar edit_icon_css\t= 'dashicons-edit';\n\n\tif ( jQuery( '#panda-repeater-trash-info-' + cpodid + '-' + poditemid ).data( 'enable-trash' ) == 1 ) {\n\t\tif ( typeof items['trashed'] != 'undefined' && items['trashed'] == 1 ) {\n\n\t\t\ttrashed_css \t= 'pprf-trashed';\n\t\t\tbtn_trashed_css\t= 'pprf-btn-trashed';\n\t\t\t// If the portfolio foder is open, hide the trash one.\n\t\t\tedit_icon_css = 'dashicons-update ';\n\t\t\tif ( jQuery( '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab.active .dashicons' ).hasClass( 'dashicons-portfolio' ) ) {\n\t\t\t\tdisplay_style = 'display:none;';\n\t\t\t}\n\n\t\t} else {\n\t\t\ttrashed_css\t\t= 'pprf-not-trashed';\n\t\t\tbtn_trashed_css\t= 'pprf-btn-not-trashed';\n\t\t\tif ( jQuery( '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab.active .dashicons' ).hasClass( 'dashicons-trash' ) ) {\n\t\t\t\tdisplay_style = 'display:none;';\n\t\t\t}\n\t\t}\n\t}\n\tvar repeated_css_append\t= '';\n\tif ( is_repeated == true ) {\n\t\trepeated_css_append\t= '-repeated';\n\t}\n\tvar delete_action = '';\n\tvar ids_in_css = cpodid + '-' + items['id'] + '-' + poditemid;\n\tvar responding_id = items['id'];\n\tvar the_title = items['title'];\n\tvar the_label = the_title;\n\n\tif ( typeof items['label'] != 'undefined' && items['label'] != '' ) {\n\t\tthe_label = items['label'];\n\t}\n\tvar next_background_css\t= jQuery( '#next-bg' ).data( 'bg' );\n\tvar full_url\t \t\t= PANDA_PODS_REPEATER_PAGE_URL[0] + 'iframe_id=panda-repeater-edit-' + ids_in_css + '&podid=' + podid + '&tb=' + cpodid + '&postid=' + postid + '&itemid=' + responding_id + '&poditemid=' + poditemid + '&pprf_nonce=' + PANDA_PODS_REPEATER_CONSTANTS.nonce;\n\tvar html_build \t\t=\n\t'<li data-id=\"' + responding_id + '\" class=\"' + trashed_css + '\" id=\"li-' + ids_in_css + repeated_css_append + '\" style=\"' + display_style + '\">' +\n\t\t'<div class=\"pprf-row w100 pprf-left\">' +\n\t\t\t'<div class=\"w100 pprf-left\" id=\"pprf-row-brief-' + ids_in_css + repeated_css_append + '\">' +\n\t\t\t\t'<div class=\"pprf-left pd8 pprf-left-col ' + next_background_css + ' \">' + the_label + '</div>';\n\n\tif ( is_repeated == true ) {\n\t\thtml_build +=\n\t\t'<div class=\"button pprf-right-col center pprf-dismiss-btn ' + delete_action + ' ' + btn_trashed_css + '\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' +\n\t\t\t'<span class=\"dashicons dashicons-dismiss pdt6 mgb0 \"></span>' +\n\t\t'</div>' +\n\t\t'<div class=\"pprf-left pd8\">Repeated</div>';\n\t} else {\n\t\thtml_build +=\n\t\t'<div class=\"button pprf-right-col center pprf-trash-btn ' + delete_action + ' ' + btn_trashed_css + '\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' +\n\t\t\t'<span class=\"dashicons dashicons-trash pdt6 mgb0 \"></span>' +\n\t\t\t'<div id=\"panda-repeater-trash-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\n\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_CONSTANTS.url + '/images/dots-loading.gif\" alt=\"loading\" class=\"mgl8 loading pprf-left\"/>' +\n\t\t\t'</div>' +\n\t\t'</div>' +\n\t\t'<div class=\"button pprf-right-col center pprf-save-btn\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' +\n\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_CONSTANTS.url + 'images/save-icon-tran.png\" class=\"pprf-save-icon mgt8 mgb2\"/>' +\n\t\t\t'<div id=\"panda-repeater-save-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\n\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_CONSTANTS.url + 'images/dots-loading.gif\" alt=\"loading\" class=\"mgl8 pprf-left\"/>' +\n\t\t\t'</div>' +\n\t\t'</div>' +\n\t\t'<div class=\"button pprf-edit pprf-row-load-iframe alignright pprf-right-col center pprf-edit-btn\" role=\"button\" data-target=\"' + ids_in_css + '\" data-url=\"' + full_url + '\">' +\n\t\t\t'<span class=\"dashicons ' + edit_icon_css + ' pdt8 mgb0 pprf-edit-span\"></span>' +\n\t\t\t'<div id=\"panda-repeater-edit-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\n\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_CONSTANTS.url + '/images/dots-loading.gif\" alt=\"loading\" class=\"mgl9 pprf-left\"/>' +\n\t\t\t'</div>\t' +\n\t\t'</div>';\n\t}\n\thtml_build +=\n\t\t'</div>' +\n\t\t'<div>' +\n\t\t\t'<iframe id=\"panda-repeater-edit-' + ids_in_css + '\" frameborder=\"0\" scrolling=\"no\" src=\"\" style=\"display:none; \" class=\"panda-repeater-iframe w100\"></iframe>' +\n\t\t\t'<div id=\"panda-repeater-edit-expand-' + ids_in_css + '\" class=\"w100 pprf-left center pdt3 pdb3 pprf-expand-bar pprf-edit-expand\" data-target=\"' + ids_in_css + '\" style=\"display:none;\">Content missing? Click here to expand</div>' +\n\t\t'</div>' +\n\t\t'</div>' +\n\t'</li>';\n\tif ( next_background_css === 'pprf-purple-bg' ) {\n\t\tjQuery( '#next-bg' ).data( 'bg', 'pprf-white-bg' );\n\t} else {\n\t\tjQuery( '#next-bg' ).data( 'bg', 'pprf-purple-bg' );\n\t}\n\treturn html_build;\n}\n/**\n * Delete an item\n */\nfunction pprf_delete_item( podid, postid, cpodid, itemid, authorid , iframeid, poditemid, trashed ){\n\n\tif ( false === isNaN( podid ) && false === isNaN( cpodid ) && false === isNaN( authorid ) && false === isNaN( itemid ) && false === isNaN( poditemid ) ) {\n\n\t\tvar para_obj = { 'podid': podid, 'postid': postid, 'cpodid': cpodid, 'itemid' : itemid, 'authorid': authorid, 'poditemid' : poditemid, 'action' : 'admin_pprf_delete_item', 'trash' : trashed, 'security' : ajax_script.nonce };\n\t\tvar info_text = '';\n\t\tif ( trashed == 0 ) {\n\t\t\tinfo_text = strs_obj.be_restored;\n\t\t}\n\t\tif ( trashed == 1 ) {\n\t\t\tinfo_text = strs_obj.can_recover;\n\t\t}\n\t\tif ( trashed == 2 ) {\n\t\t\tinfo_text = strs_obj.be_deleted;\n\t\t}\n\n\t\tvar data_obj = para_obj;\n\t\tvar passed = confirm( strs_obj.you_sure + ' ' + info_text );\n\n\t\tif ( passed === true ) {\n\n\t\t\tif ( trashed == 0 ) {\n\t\t\t\tjQuery( '#panda-repeater-edit-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).removeClass( 'hidden' );\n\t\t\t} else {\n\t\t\t\tjQuery( '#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).removeClass( 'hidden' );\n\t\t\t}\n\n\t\t\tjQuery.post(\n\t\t\t\tajax_script.ajaxurl,\n\t\t\t\tdata_obj,\n\t\t\t\tfunction( responses ){\n\t\t\t\t\tif ( responses['success'] === true ) {\n\t\t\t\t\t\tvar response_data = responses['data'];\n\t\t\t\t\t\tif ( response_data.length != 0 ) {\n\t\t\t\t\t\t\tvar ids_in_css = cpodid + '-' + itemid + '-' + poditemid;\n\t\t\t\t\t\t\tvar exp_str = 'panda-repeater-edit-expand-' + ids_in_css;\n\t\t\t\t\t\t\tvar iframe_build = 'panda-repeater-edit-' + ids_in_css;\n\n\t\t\t\t\t\t\tif ( trashed == 0 ) {\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-edit-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).addClass( 'hidden' );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).addClass( 'hidden' );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( trashed == 0 ) {\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).removeClass( 'dashicons-update' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).addClass( 'dashicons-edit' )\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).removeClass( 'pprf-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).addClass( 'pprf-not-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).css( 'display', 'none' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn' ).addClass( 'pprf-btn-not-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn' ).removeClass( 'pprf-btn-trashed' );\n\n\t\t\t\t\t\t\t\tif ( jQuery.trim( jQuery( '#' + iframe_build ).contents().find( \"body\" ).html() ) != '' ) {\n\t\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-save-btn .pprf-save-icon' ).attr( 'src', PANDA_PODS_REPEATER_CONSTANTS.url + 'images/save-icon.png' );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( trashed == 1 ) {\n\n\t\t\t\t\t\t\t\tif ( jQuery( '#' + iframe_build ) != 'undefined' ) {\n\t\t\t\t\t\t\t\t\tjQuery( '#' + iframe_build ).hide();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( jQuery( '#' + exp_str ) != 'undefined' ) {\n\t\t\t\t\t\t\t\t\tjQuery( '#' + exp_str ).hide();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tjQuery( '#pprf-row-brief-' + ids_in_css + ' .dashicons' ).removeClass( 'dashicons-arrow-up' );\n\t\t\t\t\t\t\t\tjQuery( '#pprf-row-brief-' + ids_in_css + ' .dashicons' ).addClass( 'dashicons-edit' );\n\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).removeClass( 'pprf-not-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).addClass( 'pprf-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).css( 'display', 'none' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).addClass( 'dashicons-update' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).removeClass( 'dashicons-edit' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn' ).addClass( 'pprf-btn-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn' ).removeClass( 'pprf-btn-not-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-save-btn .pprf-save-icon' ).attr( 'src', PANDA_PODS_REPEATER_CONSTANTS.url + 'images/save-icon-tran.png' );\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( trashed == 2 ) {\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' #' + iframeid ).parent().parent().remove();\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).remove();\n\t\t\t\t\t\t\t\t// If entries limit, toggle the add new.\n\t\t\t\t\t\t\t\tvar items_left_count = jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li' ).length;\n\t\t\t\t\t\t\t\tvar limit_int = parseInt( jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-entry-limit' ).val() );\n\t\t\t\t\t\t\t\tif ( limit_int != 0 && items_left_count < limit_int ) {\n\t\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new' ).removeClass( 'hidden' );\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Integrate with simpods js.\n\t\t\t\t\t\t\t\tif ( typeof call_simpods !== 'undefined' && jQuery.isFunction( call_simpods ) ) {\n\t\t\t\t\t\t\t\t\tcall_simpods( responses );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tpprf_odd_even_color( cpodid + '-' + poditemid );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t}\n\t}\n}\n\njQuery( document ).on(\n\t'click',\n\t'.pprf-redorder-btn',\n\tfunction( evt ){\n\t\tvar id = jQuery( this ).data( 'id' );\n\t\tjQuery( this ).addClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-save-redorder-btn' ).removeClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-redorder-list-wrap' ).removeClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-row' ).addClass( 'hidden' );\n\t\tjQuery( '#' + id + '-add-new' ).addClass( 'hidden' );\n\t}\n);\n\n\njQuery( document ).on(\n\t'click',\n\t'.pprf-save-redorder-btn',\n\tfunction( evt ){\n\t\tvar id = jQuery( this ).data( 'id' );\n\t\tjQuery( this ).addClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-redorder-list-wrap' ).addClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-save-redorder-btn' ).addClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-redorder-btn' ).removeClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-row' ).removeClass( 'hidden' );\n\t\tjQuery( '#' + id + '-add-new' ).removeClass( 'hidden' );\n\t}\n);\n/**\n * Load more.\n */\njQuery( document ).on(\n\t'click',\n\t'.pprf-load-more-btn',\n\tfunction( evt ){\n\t\tevt.preventDefault();\n\t\tjQuery( '#pprf-load-more-wrap-' + jQuery( this ).data( 'target' ) + ' .pprf-ajax-img' ).css( 'display', 'block' );\n\n\t\tpprf_load_more( jQuery( this ).data( 'target' ), jQuery( this ) );\n\n\t}\n)\n\nfunction pprf_load_more( target_str, ele_obj ){\n\tvar loaded_arr = new Array();\n\tjQuery( '#panda-repeater-fields-' + target_str + ' .pprf-redorder-list li' ).each(\n\t\tfunction( idx_int ) {\n\t\t\tloaded_arr[ idx_int ] = parseInt( jQuery( this ).data( 'id' ) );\n\t\t}\n\t);\n\n\tvar data_obj = {\n\t\taction \t\t: \t'admin_pprf_load_more',\n\t\tloaded \t\t:\tloaded_arr,\n\t\tsecurity \t: \tajax_script.nonce,\n\t\tpod_id\t\t: \tele_obj.data( 'podid' ),\n\t\tpost_id\t\t: \tele_obj.data( 'postid' ),\n\t\tsaved_tb\t: \tele_obj.data( 'tb' ),\n\t\tiframe_id \t: \tele_obj.data( 'iframe_id' ),\n\t\tpod_item_id\t: \tele_obj.data( 'poditemid' ),\n\t\tauthorid\t: \tele_obj.data( 'userid' ),\n\t\tcp_title\t: \tele_obj.data( 'cptitle' ),\n\t\ttrashable\t: \tele_obj.data( 'enable-trash' ),\n\t\torder\t\t: \tele_obj.data( 'order' ),\n\t\torder_by\t: \tele_obj.data( 'order-by' ),\n\t\tamount\t\t: \tjQuery( '#panda-repeater-amount-' + target_str ).val(),\n\t\tstart\t\t: \tjQuery( '#panda-repeater-start-from-' + target_str ).val()\n\t};\n\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-load-more-report' ).text( '' );\n\tjQuery.post(\n\t\tajax_script.ajaxurl,\n\t\tdata_obj,\n\t\tfunction( response_obj ){\n\t\t\tvar html_build = '';\n\t\t\tif ( response_obj.success == true ) {\n\t\t\t\tvar trashed_count = 0;\n\t\t\t\tvar data_length = response_obj.data.length;\n\t\t\t\tvar loaded_length = loaded_arr.length;\n\t\t\t\tfor ( var i = 0; i < data_length; i ++ ) {\n\t\t\t\t\tvar is_repeated\t= false;\n\n\t\t\t\t\tif ( jQuery( '#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load' ).val() === 'append_to' ) { // Only need to check repeatition if it is on Append To.\n\t\t\t\t\t\tfor ( var j = 0; j < loaded_length; j ++ ) {\t// InArry doesn't work.\n\t\t\t\t\t\t\tif ( parseInt( response_obj.data[ i ]['id'] ) == loaded_arr[ j ] ) {\n\t\t\t\t\t\t\t\tis_repeated\t= true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\thtml_build += pprf_build_item_html( response_obj.data[ i ], data_obj.pod_id, data_obj.post_id, data_obj.saved_tb, data_obj.authorid , data_obj.iframe_id, data_obj.pod_item_id, data_obj.cp_title, is_repeated )\n\t\t\t\t\tif ( response_obj.data[ i ]['trashed'] == 1 ) {\n\t\t\t\t\t\ttrashed_count ++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar info_text = response_obj.data.length;\n\t\t\t\tif ( data_obj.trashable == 1 ) {\n\t\t\t\t\tinfo_text = ( parseInt( response_obj.data.length ) - trashed_count ) + ' published, ' + trashed_count + ' trashed.';\n\t\t\t\t}\n\t\t\t\tif ( jQuery( '#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load' ).val() == 'append_to' ) {\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + data_obj.saved_tb + '-' + data_obj.pod_item_id + ' .pprf-redorder-list' ).append( html_build );\n\t\t\t\t} else {\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + data_obj.saved_tb + '-' + data_obj.pod_item_id + ' .pprf-redorder-list' ).html( html_build );\n\t\t\t\t}\n\t\t\t\tpprf_odd_even_color( data_obj.saved_tb + '-' + data_obj.pod_item_id );\n\t\t\t\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-ajax-img' ).css( 'display', 'none' );\n\n\t\t\t\tif ( response_obj.data.length != 0 ) {\n\t\t\t\t\tjQuery( '#panda-repeater-start-from-' + target_str ).val( parseInt( data_obj.start ) + parseInt( response_obj.data.length ) );\n\t\t\t\t}\n\n\t\t\t\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-load-more-report' ).text( ' | Loaded ' + info_text );\n\t\t\t}\n\n\t\t}\n\t);\n}\n/**\n * Reset colours for each row.\n */\nfunction pprf_odd_even_color( ids ){\n\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col' ).removeClass( 'pprf-purple-bg' );\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col' ).removeClass( 'pprf-white-bg' );\n\n\tif ( jQuery( '#panda-repeater-fields-tabs-' + ids ).length == 0 ) {\n\n\t\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col' ).each(\n\t\t\tfunction( idx ) {\n\t\t\t\tif ( idx % 2 == 0 ) {\n\t\t\t\t\tjQuery( this ).addClass( 'pprf-white-bg' );\n\t\t\t\t} else {\n\t\t\t\t\tjQuery( this ).addClass( 'pprf-purple-bg' );\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t}\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-not-trashed' ).each(\n\t\tfunction( idx ) {\n\t\t\tif ( idx % 2 == 0 ) {\n\t\t\t\tjQuery( this ).children( '.pprf-row' ).children().children( '.pprf-left-col' ).addClass( 'pprf-white-bg' );\n\t\t\t} else {\n\t\t\t\tjQuery( this ).children( '.pprf-row' ).children().children( '.pprf-left-col' ).addClass( 'pprf-purple-bg' );\n\t\t\t}\n\t\t}\n\t);\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-trashed' ).each(\n\t\tfunction( idx ) {\n\t\t\tif ( idx % 2 == 0 ) {\n\t\t\t\tjQuery( this ).children( '.pprf-row' ).children().children( '.pprf-left-col' ).addClass( 'pprf-white-bg' );\n\t\t\t} else {\n\t\t\t\tjQuery( this ).children( '.pprf-row' ).children().children( '.pprf-left-col' ).addClass( 'pprf-purple-bg' );\n\t\t\t}\n\t\t}\n\t);\n}\n/**\n * If reassigned successfully, remove the item and reset colours.\n */\nfunction pprf_reassign( cpodid, poditemid, itemid ){\n\n\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).remove();\n\n\tpprf_odd_even_color( cpodid + '-' + poditemid );\n}\njQuery( document ).ready(\n\tfunction($) {\n\t\t/**\n\t\t * Fix_helper_modified for drag and drop.\n\t\t */\n\t\tvar fix_helper_modified = function(e, tr) {\n\t\t\t\tvar $originals = tr.children();\n\t\t\t\tvar $helper = tr.clone();\n\t\t\t$helper.children().each(\n\t\t\t\tfunction(index) {\n\t\t\t\t\t$( this ).width( $originals.eq( index ).width() );\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn $helper;\n\t\t},\n\t\tupdate_index = function(e, ui) {\n\t\t\t\tvar the_order = $( this ).sortable( 'toArray' );\n\n\t\t\t\tvar data_obj = {\n\t\t\t\t\taction: 'admin_pprf_update_order',\n\t\t\t\t\torder: \t the_order,\n\t\t\t\t\tsecurity : ajax_script.nonce\n\t\t\t};\n\n\t\t\t$.post(\n\t\t\t\tajax_script.ajaxurl,\n\t\t\t\tdata_obj,\n\t\t\t\tfunction( resp_arr ){\n\t\t\t\t\tpprf_odd_even_color( resp_arr.data.pprf_id );\n\t\t\t\t}\n\t\t\t)\n\t\t};\n\n\t\tif ( $( '.pprf-redorder-list.pandarf_order' ).length != 0 ) {\n\t\t\t$( '.pprf-redorder-list.pandarf_order' ).sortable(\n\t\t\t\t{\n\t\t\t\t\thelper: fix_helper_modified,\n\t\t\t\t\tcursor: 'move',\n\t\t\t\t\topacity: 0.7,\n\t\t\t\t\ttolerance: 'intersect',\n\t\t\t\t\tupdate: \t\tupdate_index,\n\t\t\t\t\tcancel: \t\t'.pprf-row-load-iframe, .pprf-save-btn, pprf-trash-btn',\n\t\t\t\t\thandle: \t\t'.pprf-left-col'\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-row-load-iframe',\n\t\t\tfunction( e ){\n\t\t\t\te.stopPropagation();\n\t\t\t\tvar url_str = $( this ).data( 'url' );\n\t\t\t\tvar ids_in_css = $( this ).data( 'target' );\n\t\t\t\tvar exp_str = 'panda-repeater-edit-expand-' + ids_in_css;\n\t\t\t\tvar iframe_build = 'panda-repeater-edit-' + ids_in_css;\n\t\t\t\tvar trash_ele = $( this ).parent().children( '.pprf-trash-btn' );\n\t\t\t\tif ( $( this ).children( '.pprf-edit-span' ).hasClass( 'dashicons-update' ) ) {\n\t\t\t\t\t// Restore this item.\n\t\t\t\t\tpprf_delete_item( trash_ele.data( 'podid' ), trash_ele.data( 'postid' ), trash_ele.data( 'tb' ), trash_ele.data( 'itemid' ), trash_ele.data( 'userid' ), trash_ele.data( 'iframe_id' ), trash_ele.data( 'poditemid' ), 0 );\n\t\t\t\t} else {\n\t\t\t\t\t\tvar addEdit_str = ' .pprf-edit';\n\t\t\t\t\tif ( $( this ).hasClass( 'pprf-add' ) ) {\n\t\t\t\t\t\taddEdit_str = '.pprf-add';\n\t\t\t\t\t\tiframe_build = 'panda-repeater-add-new-' + ids_in_css;\n\t\t\t\t\t\texp_str = 'panda-repeater-add-new-expand-' + ids_in_css;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( $( '#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass( 'dashicons-edit' ) ) {\n\n\t\t\t\t\t\t// If iframe not loaded.\n\n\t\t\t\t\t\tif ( $( '#' + iframe_build ).attr( 'src' ) == '' ) {\n\t\t\t\t\t\t\t$( '#' + iframe_build ).attr( 'src', url_str );\n\t\t\t\t\t\t\t$( '#' + iframe_build + '-loader' ).removeClass( 'hidden' );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$( '#' + iframe_build ).show(\n\t\t\t\t\t\t\t'slow',\n\t\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).addClass( 'dashicons-arrow-up' );\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).removeClass( 'dashicons-edit' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$( '#' + exp_str ).show();\n\t\t\t\t\t\t$( '#' + iframe_build ).on(\n\t\t\t\t\t\t\t'load',\n\t\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\t\t$( '#' + iframe_build + '-loader' ).addClass( 'hidden' );\n\t\t\t\t\t\t\t\t// Change icon.\n\t\t\t\t\t\t\t\t$( '#panda-repeater-save-' + ids_in_css + '-loader' ).parent().children( '.pprf-save-icon' ).attr( 'src', PANDA_PODS_REPEATER_CONSTANTS.url + '/images/save-icon.png' );\n\t\t\t\t\t\t\t\t$( '#panda-repeater-save-' + ids_in_css + '-loader' ).parent().addClass( 'pprf-btn-ready' );\n\t\t\t\t\t\t\t\t$( '#panda-repeater-save-' + ids_in_css + '-loader' ).addClass( 'hidden' );\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons' ).addClass( 'dashicons-arrow-up' );\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons' ).removeClass( 'dashicons-edit' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t$( '#' + iframe_build ).hide(\n\t\t\t\t\t\t\t'slow',\n\t\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons' ).removeClass( 'dashicons-arrow-up' );\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons' ).addClass( 'dashicons-edit' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$( '#' + exp_str ).hide();\n\n\t\t\t\t\t}\n\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + ' .dashicons-trash' ).removeClass( 'dashicons-arrow-up' );\n\t\t\t\t}\n\n\t\t\t}\n\t\t);\n\t\t/**\n\t\t * Click to explan its iframe.\n\t\t */\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-expand-bar',\n\t\t\tfunction(){\n\t\t\t\tvar ids = $( this ).data( 'target' );\n\t\t\t\tvar iframe = 'panda-repeater-edit-' + ids;\n\t\t\t\tif ( $( this ).hasClass( 'pprf-add-expand' ) ) {\n\t\t\t\t\tiframe = 'panda-repeater-add-new-' + ids;\n\t\t\t\t}\n\t\t\t\tif ( typeof document.getElementById( iframe ) != 'undefined' ) {\n\t\t\t\t\tif ( typeof document.getElementById( iframe ).contentWindow.pprf_resize_window != 'undefined' ) {\n\t\t\t\t\t\tdocument.getElementById( iframe ).contentWindow.pprf_resize_window();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t/**\n\t\t * Click to delete.\n\t\t */\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-trash-btn',\n\t\t\tfunction( e ){\n\t\t\t\te.stopPropagation();\n\t\t\t\tvar ids = $( this ).data( 'target' );\n\t\t\t\tvar iframe = 'panda-repeater-edit-' + ids;\n\t\t\t\tif ( $( this ).hasClass( 'pprf-add-expand' ) ) {\n\t\t\t\t\tiframe = 'panda-repeater-add-new-' + ids;\n\t\t\t\t}\n\t\t\t\tvar trash = 0;\n\t\t\t\tif ( $( this ).hasClass( 'pprf-btn-not-trashed' ) ) {\n\t\t\t\t\ttrash = 1;\n\t\t\t\t}\n\t\t\t\tif ( $( this ).hasClass( 'pprf-btn-trashed' ) ) {\n\t\t\t\t\ttrash = 2;\n\t\t\t\t}\n\t\t\t\tif ( $( this ).hasClass( 'pprf-btn-delete' ) ) {\n\t\t\t\t\ttrash = 2;\n\t\t\t\t}\n\t\t\t\tpprf_delete_item( $( this ).data( 'podid' ), $( this ).data( 'postid' ), $( this ).data( 'tb' ), $( this ).data( 'itemid' ), $( this ).data( 'userid' ), $( this ).data( 'iframe_id' ), $( this ).data( 'poditemid' ), trash );\n\t\t\t}\n\t\t)\n\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-save-btn',\n\t\t\tfunction( e ){\n\t\t\t\te.stopPropagation();\n\t\t\t\tif ( $( this ).hasClass( 'pprf-btn-ready' ) ) {\n\t\t\t\t\tvar ids = $( this ).data( 'target' );\n\t\t\t\t\tvar iframe = 'panda-repeater-edit-' + ids;\n\t\t\t\t\tif ( $( this ).hasClass( 'pprf-save-new-btn' ) ) {\n\t\t\t\t\t\tiframe = 'panda-repeater-add-new-' + ids;\n\t\t\t\t\t}\n\t\t\t\t\t$( '#panda-repeater-save-' + ids + '-loader' ).removeClass( 'hidden' );\n\n\t\t\t\t\t$( '#' + iframe ).contents().find( '.pods-submit-button' ).trigger( \"click\" );\n\t\t\t\t\tpprf_is_changed = false;\n\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t/**\n\t\t * If a pods is is clicked, flag it as saved.\n\t\t */\n\t\t$( '.toplevel_page_panda-pods-repeater-field .pods-field-input' ).on(\n\t\t\t'click keyup change',\n\t\t\tfunction(){\n\t\t\t\tpprf_is_changed = true;\n\t\t\t}\n\t\t);\n\n\t\t$( document ).on(\n\t\t\t'click',\n\t\t\t'#publishing-action .button, #save-action .button',\n\t\t\tfunction(){\n\t\t\t\tif ( pprf_is_changed ) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\tvar leave = confirm( strs_obj.Ignore_changes );\n\t\t\t\t\tif ( leave == true) {\n\t\t\t\t\t\tpprf_is_changed = false;\n\n\t\t\t\t\t\t$( this ).trigger( 'click' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( leave == false) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\t/**\n\t\t * Toggle trashed and current.\n\t\t */\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-tab .dashicons-trash',\n\t\t\tfunction(){\n\n\t\t\t\t$( '#panda-repeater-fields-' + $( this ).parent().data( 'target' ) + ' .pprf-trashed' ).css( 'display', 'block' );\n\t\t\t\t$( '#panda-repeater-fields-' + $( this ).parent().data( 'target' ) + ' .pprf-not-trashed' ).css( 'display', 'none' );\n\t\t\t\t$( this ).parent().parent().children( '.active' ).removeClass( 'active' );\n\t\t\t\t$( this ).parent().addClass( 'active' );\n\t\t\t\tpprf_odd_even_color( $( this ).parent().data( 'target' ) );\n\n\t\t\t}\n\t\t)\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-tab .dashicons-portfolio',\n\t\t\tfunction(){\n\t\t\t\t$( '#panda-repeater-fields-' + $( this ).parent().data( 'target' ) + ' .pprf-trashed' ).css( 'display', 'none' );\n\t\t\t\t$( '#panda-repeater-fields-' + $( this ).parent().data( 'target' ) + ' .pprf-not-trashed' ).css( 'display', 'block' );\n\t\t\t\t$( this ).parent().parent().children( '.active' ).removeClass( 'active' );\n\t\t\t\t$( this ).parent().addClass( 'active' );\n\t\t\t\tpprf_odd_even_color( $( this ).parent().data( 'target' ) );\n\t\t\t}\n\t\t)\n\n\t\t/**\n\t\t * Remove repeated.\n\t\t */\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-dismiss-btn',\n\t\t\tfunction(){\n\t\t\t\t$( '#li-' + $( this ).data( 'target' ) + '-repeated' ).remove();\n\t\t\t}\n\t\t)\n\t}\n);\n\nvar pprf_is_changed\t= false;\n"],"file":"admin.js"} -
panda-pods-repeater-field/trunk/js/admin.min.js
r2829601 r2837947 1 "use strict";function pprf_resize_iframe(e){e.style.height=e.contentWindow.document.body.scrollHeight+"px"}function pprf_update_iframe_size(e,a){""!=e&&jQuery("#"+e).height(jQuery("#"+e).height()).animate({height:a},500)}function pprf_update_size(e){var a;""!=e&&(a=jQuery(e+" html #wpbody-content").height()+60,jQuery("#"+e).height(jQuery("#"+e).height()).animate({height:a},500))}function pprf_update_parent_iframe(e){var a;""!=e&&(a=jQuery("#"+e+" html #wpbody-content").height(),jQuery("#"+e).height(jQuery("#"+e).height()).animate({height:a},500))}var pprf_parent_height=jQuery("html").height();function pprf_new(r,d,t,p,i,s,n){var e; jQuery.isNumeric(r)&&jQuery.isNumeric(t)&&jQuery.isNumeric(p)&&jQuery.isNumeric(s)&&(e={podid:r,postid:d,cpodid:t,authorid:p,poditemid:s,action:"admin_pprf_load_newly_added",security:ajax_script.nonce},jQuery("#panda-repeater-fields-"+t+"-"+s+"-loader").removeClass("hidden"),jQuery.post(ajax_script.ajaxurl,e,function(e){jQuery("#panda-repeater-fields-"+t+"-"+s+"-loader").addClass("hidden");var a=e.data;!0===e.success&&void 0!==a.id&&jQuery.isNumeric(a.id)&&(e=pprf_build_item_html(a,r,d,t,p,i,s,n,!1),jQuery("#panda-repeater-fields-"+t+"-"+s+" .pprf-redorder-list").append(e),a=jQuery("#panda-repeater-fields-"+t+"-"+s+" > .pprf-redorder-list > li").length,0!=(e=parseInt(jQuery("#panda-repeater-fields-"+t+"-"+s+"-entry-limit").val()))&&e<=a&&jQuery("#panda-repeater-fields-"+t+"-"+s+"-add-new").addClass("hidden")),jQuery("#panda-repeater-fields-tabs-"+t+"-"+s+" .pprf-tab .dashicons-portfolio").click(),pprf_odd_even_color(t+"-"+s)}))}function pprf_build_item_html(e,a,r,d,t,p,i,s,n){if(void 0===e.id||!jQuery.isNumeric(e.id)||!jQuery.isNumeric(a))return"";var o="",l="pprf-btn-delete",f="",c="dashicons-edit";1==jQuery("#panda-repeater-trash-info-"+d+"-"+i).data("enable-trash")&&(void 0!==e.trashed&&1==e.trashed?(o="pprf-trashed",l="pprf-btn-trashed",c="dashicons-update ",jQuery("#panda-repeater-fields-tabs-"+d+"-"+i+" .pprf-tab.active .dashicons").hasClass("dashicons-portfolio")&&(f="display:none;")):(o="pprf-not-trashed",l="pprf-btn-not-trashed",jQuery("#panda-repeater-fields-tabs-"+d+"-"+i+" .pprf-tab.active .dashicons").hasClass("dashicons-trash")&&(f="display:none;")));var h="";1==n&&(h="-repeated");var u=d+"-"+e.id+"-"+i,m=e.id,_=e.title;void 0!==e.label&&""!=e.label&&(_=e.label);var y=jQuery("#next-bg").data("bg"),e=PANDA_PODS_REPEATER_PAGE_URL[0]+"iframe_id=panda-repeater-edit-"+u+"&podid="+a+"&tb="+d+"&postid="+r+"&itemid="+m+"&poditemid="+i,_='<li data-id="'+m+'" class="'+o+'" id="li-'+u+h+'" style="'+f+'"><div class="pprf-row w100 pprf-left"><div class="w100 pprf-left" id="pprf-row-brief-'+u+h+'"><div class="pprf-left pd8 pprf-left-col '+y+' ">'+_+"</div>";return _+=1==n?'<div class="button pprf-right-col center pprf-dismiss-btn '+l+'" role="button" data-podid="'+a+'" data-postid="'+r+'" data-tb="'+d+'" data-itemid="'+m+'" data-userid="'+t+'" data-iframe_id="panda-repeater-edit-'+u+'" data-poditemid="'+i+'" data-target="'+u+'" ><span class="dashicons dashicons-dismiss pdt6 mgb0 "></span></div><div class="pprf-left pd8">Repeated</div>':'<div class="button pprf-right-col center pprf-trash-btn '+l+'" role="button" data-podid="'+a+'" data-postid="'+r+'" data-tb="'+d+'" data-itemid="'+m+'" data-userid="'+t+'" data-iframe_id="panda-repeater-edit-'+u+'" data-poditemid="'+i+'" data-target="'+u+'" ><span class="dashicons dashicons-trash pdt6 mgb0 "></span><div id="panda-repeater-trash-'+u+'-loader" class="pprf-left hidden mgl5"><img src = "'+PANDA_PODS_REPEATER_URL[0]+'/images/dots-loading.gif" alt="loading" class="mgl8 loading pprf-left"/></div></div><div class="button pprf-right-col center pprf-save-btn" role="button" data-podid="'+a+'" data-postid="'+r+'" data-tb="'+d+'" data-itemid="'+m+'" data-userid="'+t+'" data-iframe_id="panda-repeater-edit-'+u+'" data-poditemid="'+i+'" data-target="'+u+'" ><img src = "'+PANDA_PODS_REPEATER_URL[0]+'images/save-icon-tran.png" class="pprf-save-icon mgt8 mgb2"/><div id="panda-repeater-save-'+u+'-loader" class="pprf-left hidden mgl5"><img src = "'+PANDA_PODS_REPEATER_URL[0]+'images/dots-loading.gif" alt="loading" class="mgl8 pprf-left"/></div></div><div class="button pprf-edit pprf-row-load-iframe alignright pprf-right-col center pprf-edit-btn" role="button" data-target="'+u+'" data-url="'+e+'"><span class="dashicons '+c+' pdt8 mgb0 pprf-edit-span"></span><div id="panda-repeater-edit-'+u+'-loader" class="pprf-left hidden mgl5"><img src = "'+PANDA_PODS_REPEATER_URL[0]+'/images/dots-loading.gif" alt="loading" class="mgl9 pprf-left"/></div>\t</div>',_+='</div><div><iframe id="panda-repeater-edit-'+u+'" frameborder="0" scrolling="no" src="" style="display:none; " class="panda-repeater-iframe w100"></iframe><div id="panda-repeater-edit-expand-'+u+'" class="w100 pprf-left center pdt3 pdb3 pprf-expand-bar pprf-edit-expand" data-target="'+u+'" style="display:none;">Content missing? Click here to expand</div></div></div></li>',"pprf-purple-bg"==y?jQuery("#next-bg").data("bg","pprf-white-bg"):jQuery("#next-bg").data("bg","pprf-purple-bg"),_}function pprf_delete_item(e,a,t,p,r,i,s,n){jQuery.isNumeric(e)&&jQuery.isNumeric(t)&&jQuery.isNumeric(r)&&jQuery.isNumeric(p)&&jQuery.isNumeric(s)&&(a={podid:e,postid:a,cpodid:t,itemid:p,authorid:r,poditemid:s,action:"admin_pprf_delete_item",trash:n,security:ajax_script.nonce},r="",0==n&&(r=strs_obj.be_restored),1==n&&(r=strs_obj.can_recover),2==n&&(r=strs_obj.be_deleted),a=a,1==confirm(strs_obj.you_sure+" "+r)&&((0==n?jQuery("#panda-repeater-edit-"+t+"-"+p+"-"+s+"-loader"):jQuery("#panda-repeater-trash-"+t+"-"+p+"-"+s+"-loader")).removeClass("hidden"),jQuery.post(ajax_script.ajaxurl,a,function(e){var a,r,d;!0===e.success&&0!=e.data.length&&(r="panda-repeater-edit-expand-"+(d=t+"-"+p+"-"+s),a="panda-repeater-edit-"+d,(0==n?jQuery("#panda-repeater-edit-"+t+"-"+p+"-"+s+"-loader"):jQuery("#panda-repeater-trash-"+t+"-"+p+"-"+s+"-loader")).addClass("hidden"),0==n&&(jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-row-load-iframe .pprf-edit-span').removeClass("dashicons-update"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-row-load-iframe .pprf-edit-span').addClass("dashicons-edit"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').removeClass("pprf-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').addClass("pprf-not-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').css("display","none"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-trash-btn').addClass("pprf-btn-not-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-trash-btn').removeClass("pprf-btn-trashed"),""!=jQuery.trim(jQuery("#"+a).contents().find("body").html())&&jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-save-btn .pprf-save-icon').attr("src",PANDA_PODS_REPEATER_URL[0]+"images/save-icon.png")),1==n&&("undefined"!=jQuery("#"+a)&&jQuery("#"+a).hide(),"undefined"!=jQuery("#"+r)&&jQuery("#"+r).hide(),jQuery("#pprf-row-brief-"+d+" .dashicons").removeClass("dashicons-arrow-up"),jQuery("#pprf-row-brief-"+d+" .dashicons").addClass("dashicons-edit"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').removeClass("pprf-not-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').addClass("pprf-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').css("display","none"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-row-load-iframe .pprf-edit-span').addClass("dashicons-update"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-row-load-iframe .pprf-edit-span').removeClass("dashicons-edit"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-trash-btn').addClass("pprf-btn-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-trash-btn').removeClass("pprf-btn-not-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-save-btn .pprf-save-icon').attr("src",PANDA_PODS_REPEATER_URL[0]+"images/save-icon-tran.png")),2==n&&(jQuery("#panda-repeater-fields-"+t+"-"+s+" #"+i).parent().parent().remove(),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').remove(),r=jQuery("#panda-repeater-fields-"+t+"-"+s+" > .pprf-redorder-list > li").length,0!=(d=parseInt(jQuery("#panda-repeater-fields-"+t+"-"+s+"-entry-limit").val()))&&r<d&&jQuery("#panda-repeater-fields-"+t+"-"+s+"-add-new").removeClass("hidden"),"undefined"!=typeof call_simpods&&jQuery.isFunction(call_simpods)&&call_simpods(e)),pprf_odd_even_color(t+"-"+s))})))}function pprf_load_more(s,e){var n=new Array;jQuery("#panda-repeater-fields-"+s+" .pprf-redorder-list li").each(function(e){n[e]=parseInt(jQuery(this).data("id"))});var o={action:"admin_pprf_load_more",loaded:n,security:ajax_script.nonce,pod_id:e.data("podid"),post_id:e.data("postid"),saved_tb:e.data("tb"),iframe_id:e.data("iframe_id"),pod_item_id:e.data("poditemid"),authorid:e.data("userid"),cp_title:e.data("cptitle"),trashable:e.data("enable-trash"),order:e.data("order"),order_by:e.data("order-by"),amount:jQuery("#panda-repeater-amount-"+s).val(),start:jQuery("#panda-repeater-start-from-"+s).val()};jQuery("#pprf-load-more-wrap-"+s+" .pprf-load-more-report").text(""),jQuery.post(ajax_script.ajaxurl,o,function(e){var a="";if(1==e.success){for(var r=0,d=0;d<e.data.length;d++){var t=!1;if("append_to"==jQuery("#pprf-load-more-wrap-"+s+" .panda-repeater-to-load").val())for(var p=0;p<n.length;p++)if(parseInt(e.data[d].id)==n[p]){t=!0;break}a+=pprf_build_item_html(e.data[d],o.pod_id,o.post_id,o.saved_tb,o.authorid,o.iframe_id,o.pod_item_id,o.cp_title,t),1==e.data[d].trashed&&r++}var i=e.data.length;1==o.trashable&&(i=parseInt(e.data.length)-r+" published, "+r+" trashed."),"append_to"==jQuery("#pprf-load-more-wrap-"+s+" .panda-repeater-to-load").val()?jQuery("#panda-repeater-fields-"+o.saved_tb+"-"+o.pod_item_id+" .pprf-redorder-list").append(a):jQuery("#panda-repeater-fields-"+o.saved_tb+"-"+o.pod_item_id+" .pprf-redorder-list").html(a),pprf_odd_even_color(o.saved_tb+"-"+o.pod_item_id),jQuery("#pprf-load-more-wrap-"+s+" .pprf-ajax-img").css("display","none"),0!=e.data.length&&jQuery("#panda-repeater-start-from-"+s).val(parseInt(o.start)+parseInt(e.data.length)),jQuery("#pprf-load-more-wrap-"+s+" .pprf-load-more-report").text(" | Loaded "+i)}})}function pprf_odd_even_color(e){jQuery("#panda-repeater-fields-"+e+" .pprf-left-col").removeClass("pprf-purple-bg"),jQuery("#panda-repeater-fields-"+e+" .pprf-left-col").removeClass("pprf-white-bg"),0==jQuery("#panda-repeater-fields-tabs-"+e).length&&jQuery("#panda-repeater-fields-"+e+" .pprf-left-col").each(function(e){e%2==0?jQuery(this).addClass("pprf-white-bg"):jQuery(this).addClass("pprf-purple-bg")}),jQuery("#panda-repeater-fields-"+e+" .pprf-not-trashed").each(function(e){e%2==0?jQuery(this).children(".pprf-row").children().children(".pprf-left-col").addClass("pprf-white-bg"):jQuery(this).children(".pprf-row").children().children(".pprf-left-col").addClass("pprf-purple-bg")}),jQuery("#panda-repeater-fields-"+e+" .pprf-trashed").each(function(e){e%2==0?jQuery(this).children(".pprf-row").children().children(".pprf-left-col").addClass("pprf-white-bg"):jQuery(this).children(".pprf-row").children().children(".pprf-left-col").addClass("pprf-purple-bg")})}function pprf_reassign(e,a,r){jQuery("#panda-repeater-fields-"+e+"-"+a+' .pprf-redorder-list li[data-id="'+r+'"]').remove(),pprf_odd_even_color(e+"-"+a)}jQuery(document).on("click",".pprf-redorder-btn",function(e){var a=jQuery(this).data("id");jQuery(this).addClass("hidden"),jQuery(this).parent().children(".pprf-save-redorder-btn").removeClass("hidden"),jQuery(this).parent().children(".pprf-redorder-list-wrap").removeClass("hidden"),jQuery(this).parent().children(".pprf-row").addClass("hidden"),jQuery("#"+a+"-add-new").addClass("hidden")}),jQuery(document).on("click",".pprf-save-redorder-btn",function(e){var a=jQuery(this).data("id");jQuery(this).addClass("hidden"),jQuery(this).parent().children(".pprf-redorder-list-wrap").addClass("hidden"),jQuery(this).parent().children(".pprf-save-redorder-btn").addClass("hidden"),jQuery(this).parent().children(".pprf-redorder-btn").removeClass("hidden"),jQuery(this).parent().children(".pprf-row").removeClass("hidden"),jQuery("#"+a+"-add-new").removeClass("hidden")}),jQuery(document).on("click",".pprf-load-more-btn",function(e){e.preventDefault(),jQuery("#pprf-load-more-wrap-"+jQuery(this).data("target")+" .pprf-ajax-img").css("display","block"),pprf_load_more(jQuery(this).data("target"),jQuery(this))}),jQuery(document).ready(function(i){0!=i(".pprf-redorder-list.pandarf_order").length&&i(".pprf-redorder-list.pandarf_order").sortable({helper:function(e,a){var r=a.children(),a=a.clone();return a.children().each(function(e){i(this).width(r.eq(e).width())}),a},cursor:"move",opacity:.7,tolerance:"intersect",update:function(){var e={action:"admin_pprf_update_order",order:i(this).sortable("toArray"),security:ajax_script.nonce};i.post(ajax_script.ajaxurl,e,function(e){pprf_odd_even_color(e.data.pprf_id)})},cancel:".pprf-row-load-iframe, .pprf-save-btn, pprf-trash-btn",handle:".pprf-left-col"}),i(document.body).on("click",".pprf-row-load-iframe",function(e){e.stopPropagation();var a,r=i(this).data("url"),d=i(this).data("target"),t="panda-repeater-edit-expand-"+d,p="panda-repeater-edit-"+d,e=i(this).parent().children(".pprf-trash-btn");i(this).children(".pprf-edit-span").hasClass("dashicons-update")?pprf_delete_item(e.data("podid"),e.data("postid"),e.data("tb"),e.data("itemid"),e.data("userid"),e.data("iframe_id"),e.data("poditemid"),0):(a=" .pprf-edit",i(this).hasClass("pprf-add")&&(a=".pprf-add",p="panda-repeater-add-new-"+d,t="panda-repeater-add-new-expand-"+d),i("#pprf-row-brief-"+d+" .dashicons").hasClass("dashicons-edit")?(""==i("#"+p).attr("src")&&(i("#"+p).attr("src",r),i("#"+p+"-loader").removeClass("hidden")),i("#"+p).show("slow",function(){i("#pprf-row-brief-"+d+a+" .dashicons").addClass("dashicons-arrow-up"),i("#pprf-row-brief-"+d+a+" .dashicons").removeClass("dashicons-edit")}),i("#"+t).show(),i("#"+p).on("load",function(){i("#"+p+"-loader").addClass("hidden"),i("#panda-repeater-save-"+d+"-loader").parent().children(".pprf-save-icon").attr("src",PANDA_PODS_REPEATER_URL[0]+"/images/save-icon.png"),i("#panda-repeater-save-"+d+"-loader").parent().addClass("pprf-btn-ready"),i("#panda-repeater-save-"+d+"-loader").addClass("hidden"),i("#pprf-row-brief-"+d+a+" .dashicons").addClass("dashicons-arrow-up"),i("#pprf-row-brief-"+d+a+" .dashicons").removeClass("dashicons-edit")})):(i("#"+p).hide("slow",function(){i("#pprf-row-brief-"+d+a+" .dashicons").removeClass("dashicons-arrow-up"),i("#pprf-row-brief-"+d+a+" .dashicons").addClass("dashicons-edit")}),i("#"+t).hide()),i("#pprf-row-brief-"+d+" .dashicons-trash").removeClass("dashicons-arrow-up"))}),i(document.body).on("click",".pprf-expand-bar",function(){var e=i(this).data("target"),a="panda-repeater-edit-"+e;i(this).hasClass("pprf-add-expand")&&(a="panda-repeater-add-new-"+e),void 0!==document.getElementById(a)&&void 0!==document.getElementById(a).contentWindow.pprf_resize_window&&document.getElementById(a).contentWindow.pprf_resize_window()}),i(document.body).on("click",".pprf-trash-btn",function(e){e.stopPropagation();e=i(this).data("target");i(this).hasClass("pprf-add-expand");e=0;i(this).hasClass("pprf-btn-not-trashed")&&(e=1),i(this).hasClass("pprf-btn-trashed")&&(e=2),i(this).hasClass("pprf-btn-delete")&&(e=2),pprf_delete_item(i(this).data("podid"),i(this).data("postid"),i(this).data("tb"),i(this).data("itemid"),i(this).data("userid"),i(this).data("iframe_id"),i(this).data("poditemid"),e)}),i(document.body).on("click",".pprf-save-btn",function(e){var a;e.stopPropagation(),i(this).hasClass("pprf-btn-ready")&&(e="panda-repeater-edit-"+(a=i(this).data("target")),i(this).hasClass("pprf-save-new-btn")&&(e="panda-repeater-add-new-"+a),i("#panda-repeater-save-"+a+"-loader").removeClass("hidden"),i("#"+e).contents().find(".pods-submit-button").trigger("click"),pprf_is_changed=!1)}),i(".toplevel_page_panda-pods-repeater-field .pods-field-input").on("click keyup change",function(){pprf_is_changed=!0}),i(document).on("click","#publishing-action .button, #save-action .button",function(){if(pprf_is_changed){evt.preventDefault();var e=confirm(strs_obj.Ignore_changes);if(1==e&&(pprf_is_changed=!1,i(this).trigger("click")),0==e)return!1}}),i(document.body).on("click",".pprf-tab .dashicons-trash",function(){i("#panda-repeater-fields-"+i(this).parent().data("target")+" .pprf-trashed").css("display","block"),i("#panda-repeater-fields-"+i(this).parent().data("target")+" .pprf-not-trashed").css("display","none"),i(this).parent().parent().children(".active").removeClass("active"),i(this).parent().addClass("active"),pprf_odd_even_color(i(this).parent().data("target"))}),i(document.body).on("click",".pprf-tab .dashicons-portfolio",function(){i("#panda-repeater-fields-"+i(this).parent().data("target")+" .pprf-trashed").css("display","none"),i("#panda-repeater-fields-"+i(this).parent().data("target")+" .pprf-not-trashed").css("display","block"),i(this).parent().parent().children(".active").removeClass("active"),i(this).parent().addClass("active"),pprf_odd_even_color(i(this).parent().data("target"))}),i(document.body).on("click",".pprf-dismiss-btn",function(){i("#li-"+i(this).data("target")+"-repeated").remove()})});var pprf_is_changed=!1;1 "use strict";function pprf_resize_iframe(e){e.style.height=e.contentWindow.document.body.scrollHeight+"px"}function pprf_update_iframe_size(e,a){""!=e&&jQuery("#"+e).height(jQuery("#"+e).height()).animate({height:a},500)}function pprf_update_size(e){var a;""!=e&&(a=jQuery(e+" html #wpbody-content").height()+60,jQuery("#"+e).height(jQuery("#"+e).height()).animate({height:a},500))}function pprf_update_parent_iframe(e){var a;""!=e&&(a=jQuery("#"+e+" html #wpbody-content").height(),jQuery("#"+e).height(jQuery("#"+e).height()).animate({height:a},500))}var pprf_parent_height=jQuery("html").height();function pprf_new(r,d,t,p,i,s,n){var e;!1===isNaN(r)&&!1===isNaN(t)&&!1===isNaN(p)&&!1===isNaN(s)&&(e={podid:r,postid:d,cpodid:t,authorid:p,poditemid:s,action:"admin_pprf_load_newly_added",security:ajax_script.nonce},jQuery("#panda-repeater-fields-"+t+"-"+s+"-loader").removeClass("hidden"),jQuery.post(ajax_script.ajaxurl,e,function(e){jQuery("#panda-repeater-fields-"+t+"-"+s+"-loader").addClass("hidden");var a=e.data;!0===e.success&&void 0!==a.id&&!1===isNaN(a.id)&&(e=pprf_build_item_html(a,r,d,t,p,i,s,n,!1),jQuery("#panda-repeater-fields-"+t+"-"+s+" .pprf-redorder-list").append(e),a=jQuery("#panda-repeater-fields-"+t+"-"+s+" > .pprf-redorder-list > li").length,0!=(e=parseInt(jQuery("#panda-repeater-fields-"+t+"-"+s+"-entry-limit").val()))&&e<=a&&jQuery("#panda-repeater-fields-"+t+"-"+s+"-add-new").addClass("hidden")),jQuery("#panda-repeater-fields-tabs-"+t+"-"+s+" .pprf-tab .dashicons-portfolio").click(),pprf_odd_even_color(t+"-"+s)}))}function pprf_build_item_html(e,a,r,d,t,p,i,s,n){if(void 0===e.id||!0===isNaN(e.id)||!0===isNaN(a))return"";var o="",l="pprf-btn-delete",f="",c="dashicons-edit";1==jQuery("#panda-repeater-trash-info-"+d+"-"+i).data("enable-trash")&&(void 0!==e.trashed&&1==e.trashed?(o="pprf-trashed",l="pprf-btn-trashed",c="dashicons-update ",jQuery("#panda-repeater-fields-tabs-"+d+"-"+i+" .pprf-tab.active .dashicons").hasClass("dashicons-portfolio")&&(f="display:none;")):(o="pprf-not-trashed",l="pprf-btn-not-trashed",jQuery("#panda-repeater-fields-tabs-"+d+"-"+i+" .pprf-tab.active .dashicons").hasClass("dashicons-trash")&&(f="display:none;")));var h="";1==n&&(h="-repeated");var u=d+"-"+e.id+"-"+i,_=e.id,m=e.title;void 0!==e.label&&""!=e.label&&(m=e.label);var y=jQuery("#next-bg").data("bg"),e=PANDA_PODS_REPEATER_PAGE_URL[0]+"iframe_id=panda-repeater-edit-"+u+"&podid="+a+"&tb="+d+"&postid="+r+"&itemid="+_+"&poditemid="+i+"&pprf_nonce="+PANDA_PODS_REPEATER_CONSTANTS.nonce,m='<li data-id="'+_+'" class="'+o+'" id="li-'+u+h+'" style="'+f+'"><div class="pprf-row w100 pprf-left"><div class="w100 pprf-left" id="pprf-row-brief-'+u+h+'"><div class="pprf-left pd8 pprf-left-col '+y+' ">'+m+"</div>";return m+=1==n?'<div class="button pprf-right-col center pprf-dismiss-btn '+l+'" role="button" data-podid="'+a+'" data-postid="'+r+'" data-tb="'+d+'" data-itemid="'+_+'" data-userid="'+t+'" data-iframe_id="panda-repeater-edit-'+u+'" data-poditemid="'+i+'" data-target="'+u+'" ><span class="dashicons dashicons-dismiss pdt6 mgb0 "></span></div><div class="pprf-left pd8">Repeated</div>':'<div class="button pprf-right-col center pprf-trash-btn '+l+'" role="button" data-podid="'+a+'" data-postid="'+r+'" data-tb="'+d+'" data-itemid="'+_+'" data-userid="'+t+'" data-iframe_id="panda-repeater-edit-'+u+'" data-poditemid="'+i+'" data-target="'+u+'" ><span class="dashicons dashicons-trash pdt6 mgb0 "></span><div id="panda-repeater-trash-'+u+'-loader" class="pprf-left hidden mgl5"><img src = "'+PANDA_PODS_REPEATER_CONSTANTS.url+'/images/dots-loading.gif" alt="loading" class="mgl8 loading pprf-left"/></div></div><div class="button pprf-right-col center pprf-save-btn" role="button" data-podid="'+a+'" data-postid="'+r+'" data-tb="'+d+'" data-itemid="'+_+'" data-userid="'+t+'" data-iframe_id="panda-repeater-edit-'+u+'" data-poditemid="'+i+'" data-target="'+u+'" ><img src = "'+PANDA_PODS_REPEATER_CONSTANTS.url+'images/save-icon-tran.png" class="pprf-save-icon mgt8 mgb2"/><div id="panda-repeater-save-'+u+'-loader" class="pprf-left hidden mgl5"><img src = "'+PANDA_PODS_REPEATER_CONSTANTS.url+'images/dots-loading.gif" alt="loading" class="mgl8 pprf-left"/></div></div><div class="button pprf-edit pprf-row-load-iframe alignright pprf-right-col center pprf-edit-btn" role="button" data-target="'+u+'" data-url="'+e+'"><span class="dashicons '+c+' pdt8 mgb0 pprf-edit-span"></span><div id="panda-repeater-edit-'+u+'-loader" class="pprf-left hidden mgl5"><img src = "'+PANDA_PODS_REPEATER_CONSTANTS.url+'/images/dots-loading.gif" alt="loading" class="mgl9 pprf-left"/></div>\t</div>',m+='</div><div><iframe id="panda-repeater-edit-'+u+'" frameborder="0" scrolling="no" src="" style="display:none; " class="panda-repeater-iframe w100"></iframe><div id="panda-repeater-edit-expand-'+u+'" class="w100 pprf-left center pdt3 pdb3 pprf-expand-bar pprf-edit-expand" data-target="'+u+'" style="display:none;">Content missing? Click here to expand</div></div></div></li>',"pprf-purple-bg"===y?jQuery("#next-bg").data("bg","pprf-white-bg"):jQuery("#next-bg").data("bg","pprf-purple-bg"),m}function pprf_delete_item(e,a,t,p,r,i,s,n){!1===isNaN(e)&&!1===isNaN(t)&&!1===isNaN(r)&&!1===isNaN(p)&&!1===isNaN(s)&&(a={podid:e,postid:a,cpodid:t,itemid:p,authorid:r,poditemid:s,action:"admin_pprf_delete_item",trash:n,security:ajax_script.nonce},r="",0==n&&(r=strs_obj.be_restored),1==n&&(r=strs_obj.can_recover),2==n&&(r=strs_obj.be_deleted),a=a,!0===confirm(strs_obj.you_sure+" "+r)&&((0==n?jQuery("#panda-repeater-edit-"+t+"-"+p+"-"+s+"-loader"):jQuery("#panda-repeater-trash-"+t+"-"+p+"-"+s+"-loader")).removeClass("hidden"),jQuery.post(ajax_script.ajaxurl,a,function(e){var a,r,d;!0===e.success&&0!=e.data.length&&(r="panda-repeater-edit-expand-"+(d=t+"-"+p+"-"+s),a="panda-repeater-edit-"+d,(0==n?jQuery("#panda-repeater-edit-"+t+"-"+p+"-"+s+"-loader"):jQuery("#panda-repeater-trash-"+t+"-"+p+"-"+s+"-loader")).addClass("hidden"),0==n&&(jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-row-load-iframe .pprf-edit-span').removeClass("dashicons-update"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-row-load-iframe .pprf-edit-span').addClass("dashicons-edit"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').removeClass("pprf-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').addClass("pprf-not-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').css("display","none"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-trash-btn').addClass("pprf-btn-not-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-trash-btn').removeClass("pprf-btn-trashed"),""!=jQuery.trim(jQuery("#"+a).contents().find("body").html())&&jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-save-btn .pprf-save-icon').attr("src",PANDA_PODS_REPEATER_CONSTANTS.url+"images/save-icon.png")),1==n&&("undefined"!=jQuery("#"+a)&&jQuery("#"+a).hide(),"undefined"!=jQuery("#"+r)&&jQuery("#"+r).hide(),jQuery("#pprf-row-brief-"+d+" .dashicons").removeClass("dashicons-arrow-up"),jQuery("#pprf-row-brief-"+d+" .dashicons").addClass("dashicons-edit"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').removeClass("pprf-not-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').addClass("pprf-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').css("display","none"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-row-load-iframe .pprf-edit-span').addClass("dashicons-update"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-row-load-iframe .pprf-edit-span').removeClass("dashicons-edit"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-trash-btn').addClass("pprf-btn-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-trash-btn').removeClass("pprf-btn-not-trashed"),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"] .pprf-save-btn .pprf-save-icon').attr("src",PANDA_PODS_REPEATER_CONSTANTS.url+"images/save-icon-tran.png")),2==n&&(jQuery("#panda-repeater-fields-"+t+"-"+s+" #"+i).parent().parent().remove(),jQuery("#panda-repeater-fields-"+t+"-"+s+' .pprf-redorder-list li[data-id="'+p+'"]').remove(),r=jQuery("#panda-repeater-fields-"+t+"-"+s+" > .pprf-redorder-list > li").length,0!=(d=parseInt(jQuery("#panda-repeater-fields-"+t+"-"+s+"-entry-limit").val()))&&r<d&&jQuery("#panda-repeater-fields-"+t+"-"+s+"-add-new").removeClass("hidden"),"undefined"!=typeof call_simpods&&jQuery.isFunction(call_simpods)&&call_simpods(e)),pprf_odd_even_color(t+"-"+s))})))}function pprf_load_more(o,e){var l=new Array;jQuery("#panda-repeater-fields-"+o+" .pprf-redorder-list li").each(function(e){l[e]=parseInt(jQuery(this).data("id"))});var f={action:"admin_pprf_load_more",loaded:l,security:ajax_script.nonce,pod_id:e.data("podid"),post_id:e.data("postid"),saved_tb:e.data("tb"),iframe_id:e.data("iframe_id"),pod_item_id:e.data("poditemid"),authorid:e.data("userid"),cp_title:e.data("cptitle"),trashable:e.data("enable-trash"),order:e.data("order"),order_by:e.data("order-by"),amount:jQuery("#panda-repeater-amount-"+o).val(),start:jQuery("#panda-repeater-start-from-"+o).val()};jQuery("#pprf-load-more-wrap-"+o+" .pprf-load-more-report").text(""),jQuery.post(ajax_script.ajaxurl,f,function(e){var a="";if(1==e.success){for(var r=0,d=e.data.length,t=l.length,p=0;p<d;p++){var i=!1;if("append_to"===jQuery("#pprf-load-more-wrap-"+o+" .panda-repeater-to-load").val())for(var s=0;s<t;s++)if(parseInt(e.data[p].id)==l[s]){i=!0;break}a+=pprf_build_item_html(e.data[p],f.pod_id,f.post_id,f.saved_tb,f.authorid,f.iframe_id,f.pod_item_id,f.cp_title,i),1==e.data[p].trashed&&r++}var n=e.data.length;1==f.trashable&&(n=parseInt(e.data.length)-r+" published, "+r+" trashed."),"append_to"==jQuery("#pprf-load-more-wrap-"+o+" .panda-repeater-to-load").val()?jQuery("#panda-repeater-fields-"+f.saved_tb+"-"+f.pod_item_id+" .pprf-redorder-list").append(a):jQuery("#panda-repeater-fields-"+f.saved_tb+"-"+f.pod_item_id+" .pprf-redorder-list").html(a),pprf_odd_even_color(f.saved_tb+"-"+f.pod_item_id),jQuery("#pprf-load-more-wrap-"+o+" .pprf-ajax-img").css("display","none"),0!=e.data.length&&jQuery("#panda-repeater-start-from-"+o).val(parseInt(f.start)+parseInt(e.data.length)),jQuery("#pprf-load-more-wrap-"+o+" .pprf-load-more-report").text(" | Loaded "+n)}})}function pprf_odd_even_color(e){jQuery("#panda-repeater-fields-"+e+" .pprf-left-col").removeClass("pprf-purple-bg"),jQuery("#panda-repeater-fields-"+e+" .pprf-left-col").removeClass("pprf-white-bg"),0==jQuery("#panda-repeater-fields-tabs-"+e).length&&jQuery("#panda-repeater-fields-"+e+" .pprf-left-col").each(function(e){e%2==0?jQuery(this).addClass("pprf-white-bg"):jQuery(this).addClass("pprf-purple-bg")}),jQuery("#panda-repeater-fields-"+e+" .pprf-not-trashed").each(function(e){e%2==0?jQuery(this).children(".pprf-row").children().children(".pprf-left-col").addClass("pprf-white-bg"):jQuery(this).children(".pprf-row").children().children(".pprf-left-col").addClass("pprf-purple-bg")}),jQuery("#panda-repeater-fields-"+e+" .pprf-trashed").each(function(e){e%2==0?jQuery(this).children(".pprf-row").children().children(".pprf-left-col").addClass("pprf-white-bg"):jQuery(this).children(".pprf-row").children().children(".pprf-left-col").addClass("pprf-purple-bg")})}function pprf_reassign(e,a,r){jQuery("#panda-repeater-fields-"+e+"-"+a+' .pprf-redorder-list li[data-id="'+r+'"]').remove(),pprf_odd_even_color(e+"-"+a)}jQuery(document).on("click",".pprf-redorder-btn",function(e){var a=jQuery(this).data("id");jQuery(this).addClass("hidden"),jQuery(this).parent().children(".pprf-save-redorder-btn").removeClass("hidden"),jQuery(this).parent().children(".pprf-redorder-list-wrap").removeClass("hidden"),jQuery(this).parent().children(".pprf-row").addClass("hidden"),jQuery("#"+a+"-add-new").addClass("hidden")}),jQuery(document).on("click",".pprf-save-redorder-btn",function(e){var a=jQuery(this).data("id");jQuery(this).addClass("hidden"),jQuery(this).parent().children(".pprf-redorder-list-wrap").addClass("hidden"),jQuery(this).parent().children(".pprf-save-redorder-btn").addClass("hidden"),jQuery(this).parent().children(".pprf-redorder-btn").removeClass("hidden"),jQuery(this).parent().children(".pprf-row").removeClass("hidden"),jQuery("#"+a+"-add-new").removeClass("hidden")}),jQuery(document).on("click",".pprf-load-more-btn",function(e){e.preventDefault(),jQuery("#pprf-load-more-wrap-"+jQuery(this).data("target")+" .pprf-ajax-img").css("display","block"),pprf_load_more(jQuery(this).data("target"),jQuery(this))}),jQuery(document).ready(function(i){0!=i(".pprf-redorder-list.pandarf_order").length&&i(".pprf-redorder-list.pandarf_order").sortable({helper:function(e,a){var r=a.children(),a=a.clone();return a.children().each(function(e){i(this).width(r.eq(e).width())}),a},cursor:"move",opacity:.7,tolerance:"intersect",update:function(){var e={action:"admin_pprf_update_order",order:i(this).sortable("toArray"),security:ajax_script.nonce};i.post(ajax_script.ajaxurl,e,function(e){pprf_odd_even_color(e.data.pprf_id)})},cancel:".pprf-row-load-iframe, .pprf-save-btn, pprf-trash-btn",handle:".pprf-left-col"}),i(document.body).on("click",".pprf-row-load-iframe",function(e){e.stopPropagation();var a,r=i(this).data("url"),d=i(this).data("target"),t="panda-repeater-edit-expand-"+d,p="panda-repeater-edit-"+d,e=i(this).parent().children(".pprf-trash-btn");i(this).children(".pprf-edit-span").hasClass("dashicons-update")?pprf_delete_item(e.data("podid"),e.data("postid"),e.data("tb"),e.data("itemid"),e.data("userid"),e.data("iframe_id"),e.data("poditemid"),0):(a=" .pprf-edit",i(this).hasClass("pprf-add")&&(a=".pprf-add",p="panda-repeater-add-new-"+d,t="panda-repeater-add-new-expand-"+d),i("#pprf-row-brief-"+d+" .dashicons").hasClass("dashicons-edit")?(""==i("#"+p).attr("src")&&(i("#"+p).attr("src",r),i("#"+p+"-loader").removeClass("hidden")),i("#"+p).show("slow",function(){i("#pprf-row-brief-"+d+a+" .dashicons").addClass("dashicons-arrow-up"),i("#pprf-row-brief-"+d+a+" .dashicons").removeClass("dashicons-edit")}),i("#"+t).show(),i("#"+p).on("load",function(){i("#"+p+"-loader").addClass("hidden"),i("#panda-repeater-save-"+d+"-loader").parent().children(".pprf-save-icon").attr("src",PANDA_PODS_REPEATER_CONSTANTS.url+"/images/save-icon.png"),i("#panda-repeater-save-"+d+"-loader").parent().addClass("pprf-btn-ready"),i("#panda-repeater-save-"+d+"-loader").addClass("hidden"),i("#pprf-row-brief-"+d+a+" .dashicons").addClass("dashicons-arrow-up"),i("#pprf-row-brief-"+d+a+" .dashicons").removeClass("dashicons-edit")})):(i("#"+p).hide("slow",function(){i("#pprf-row-brief-"+d+a+" .dashicons").removeClass("dashicons-arrow-up"),i("#pprf-row-brief-"+d+a+" .dashicons").addClass("dashicons-edit")}),i("#"+t).hide()),i("#pprf-row-brief-"+d+" .dashicons-trash").removeClass("dashicons-arrow-up"))}),i(document.body).on("click",".pprf-expand-bar",function(){var e=i(this).data("target"),a="panda-repeater-edit-"+e;i(this).hasClass("pprf-add-expand")&&(a="panda-repeater-add-new-"+e),void 0!==document.getElementById(a)&&void 0!==document.getElementById(a).contentWindow.pprf_resize_window&&document.getElementById(a).contentWindow.pprf_resize_window()}),i(document.body).on("click",".pprf-trash-btn",function(e){e.stopPropagation();e=i(this).data("target");i(this).hasClass("pprf-add-expand");e=0;i(this).hasClass("pprf-btn-not-trashed")&&(e=1),i(this).hasClass("pprf-btn-trashed")&&(e=2),i(this).hasClass("pprf-btn-delete")&&(e=2),pprf_delete_item(i(this).data("podid"),i(this).data("postid"),i(this).data("tb"),i(this).data("itemid"),i(this).data("userid"),i(this).data("iframe_id"),i(this).data("poditemid"),e)}),i(document.body).on("click",".pprf-save-btn",function(e){var a;e.stopPropagation(),i(this).hasClass("pprf-btn-ready")&&(e="panda-repeater-edit-"+(a=i(this).data("target")),i(this).hasClass("pprf-save-new-btn")&&(e="panda-repeater-add-new-"+a),i("#panda-repeater-save-"+a+"-loader").removeClass("hidden"),i("#"+e).contents().find(".pods-submit-button").trigger("click"),pprf_is_changed=!1)}),i(".toplevel_page_panda-pods-repeater-field .pods-field-input").on("click keyup change",function(){pprf_is_changed=!0}),i(document).on("click","#publishing-action .button, #save-action .button",function(){if(pprf_is_changed){evt.preventDefault();var e=confirm(strs_obj.Ignore_changes);if(1==e&&(pprf_is_changed=!1,i(this).trigger("click")),0==e)return!1}}),i(document.body).on("click",".pprf-tab .dashicons-trash",function(){i("#panda-repeater-fields-"+i(this).parent().data("target")+" .pprf-trashed").css("display","block"),i("#panda-repeater-fields-"+i(this).parent().data("target")+" .pprf-not-trashed").css("display","none"),i(this).parent().parent().children(".active").removeClass("active"),i(this).parent().addClass("active"),pprf_odd_even_color(i(this).parent().data("target"))}),i(document.body).on("click",".pprf-tab .dashicons-portfolio",function(){i("#panda-repeater-fields-"+i(this).parent().data("target")+" .pprf-trashed").css("display","none"),i("#panda-repeater-fields-"+i(this).parent().data("target")+" .pprf-not-trashed").css("display","block"),i(this).parent().parent().children(".active").removeClass("active"),i(this).parent().addClass("active"),pprf_odd_even_color(i(this).parent().data("target"))}),i(document.body).on("click",".pprf-dismiss-btn",function(){i("#li-"+i(this).data("target")+"-repeated").remove()})});var pprf_is_changed=!1; 2 2 //# sourceMappingURL=admin.min.js.map -
panda-pods-repeater-field/trunk/js/admin.min.js.map
r2829601 r2837947 1 {"version":3,"sources":["admin.js"],"names":["pprf_resize_iframe","obj","style","height","contentWindow","document","body","scrollHeight","pprf_update_iframe_size","x","y","jQuery","animate","pprf_update_size","pprf_original_height","pprf_update_parent_iframe","pprf_parent_height","pprf_new","podid","postid","cpodid","authorid","iframeid","poditemid","parent_name"," isNumeric","action","security","ajax_script","nonce","removeClass","post","ajaxurl","data_obj","responses","addClass","response_data","iframe_build","pprf_build_item_html","length","items_left_count","limit_int","parseInt","val","click","items","is_repeated","trashed_css","btn_trashed_css","display_style","edit_icon_css","data","hasClass","repeated_css_append","ids_in_css","the_label","next_background_css","full_url","the_title","responding_id","html_build","PANDA_PODS_REPEATER_PAGE_URL","PANDA_PODS_REPEATER_URL","info_text","trashed","pprf_delete_item","itemid","strs_obj","be_deleted","para_obj","trash","passt_bln","confirm","can_recover","pprf_odd_even_color","contents","hide","css","trim","find","html","attr","exp_str","parent","remove","call_simpods","isFunction","children","trashable","ele_obj","order","order_by","target_str","each","idx_int","amount","this","loaded","pod_id","response_obj","success","post_id","trashed_count","saved_tb","iframe_id","pod_item_id","cp_title","loaded_arr","text","i","j","append","start","ids","idx","$helper","clone","$","index","id","on","evt","preventDefault","pprf_load_more","update_index","sortable","$originals","tr","resp_arr","width","eq","cursor","opacity","addEdit_str","tolerance","update","fix_helper_modified","cancel","handle","e","url_str","pprf_id","stopPropagation","trash_ele","show","getElementById","pprf_resize_window","iframe","pprf_is_changed","Ignore_changes","leave","trigger"],"mappings":"aAAA,SAASA,mBAAmBC,GAC3BA,EAAIC,MAAMC,OAASF,EAAIG,cAAcC,SAASC,KAAKC,aAAe,KAInE,SAASC,wBAAyBC,EAAGC,GAE1B,IAALD,GACJE,OAAAA,IAAOF,GAADN,OAANQ,OAA8B,IAACF,GAAPN,UAA2BS,QAAQ,CAAAT,OAAAO,GAAA,KAC3D,SAAAG,iBAAAJ,GAID,IAFDK,EAEW,IAALL,IAFNK,EAA8BH,OAAAF,EAAA,yBAAAN,SAAA,GAG5BQ,OAAIG,IAAAA,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B,CAiBvB3B,IAACpH,iBAEAgH,IAAGiC,EAAA9E,QAAAL,SAAAkF,gBAOJ,GANI,GAAAC,IACHjC,iBAAmBlC,EAEnBT,EAAAA,MAAAA,QAAAA,UAGD,GAACrE,EACAgH,OAAG,KASNA,EAAAhH,SAAAC,MAAAkH,GAAA,QAAA,6BAAA,WACGH,EAAChH,0BAA2BgH,EAAArB,MAAAb,SAAqBhC,KAAA,UAAU,kBAAA0B,IAAA,UAAA,SAC3DwC,EAAE,0BAAwBA,EAAxBrB,MAAoCb,SAAtChC,KAAoDiC,UAApD,sBAAAP,IAAA,UAAA,QADDwC,EAAArB,MAAAb,SAAAA,SAAAI,SAAA,WAAAzD,YAAA,UA/MFuF,EAAArB,MAAAb,SAAAhD,SAAA,UAoNAuC,oBAAsB2C,EAAtBrB,MAAAb,SAAAhC,KAAA,aAhBCkE,EAAEhH,SAASC,MAAMkH,GAAG,QAAS,iCAAkC,WAC7DH,EAAG,0BAA4BA,EAAGrB,MAAMb,SAAShC,KAAK,UAAY,kBAAkB0B,IAAI,UAAW,QACnGwC,EAAG,0BAA4BA,EAAGrB,MAAMb,SAAShC,KAAK,UAAY,sBAAsB0B,IAAI,UAAW,SACvGwC,EAAGrB,MAAOb,SAASA,SAASI,SAAS,WAAWzD,YAAY,UAC5DuF,EAAGrB,MAAOb,SAAShD,SAAS,UAC5BuC,oBAAqB2C,EAAGrB,MAAMb,SAAShC,KAAK,aAM7CkE,EAAEhH,SAASC,MAAMkH,GAAG,QAAS,oBAAqB,WACjDH,EAAE,OAASA,EAAGrB,MAAO7C,KAAK,UAAY,aAAciC,aAIvD,IAAIgE,iBAAkB","file":"admin.min.js","sourcesContent":["function pprf_resize_iframe(obj) {\r\n\tobj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';\r\n\r\n}\r\n\r\nfunction pprf_update_iframe_size( x, y ){\r\n\t\r\n\tif ( x != '' ) {\r\n\t\tjQuery('#' + x).height( jQuery('#' + x).height() ).animate({height: y}, 500);\r\n\t}\r\n}\r\nfunction pprf_update_size( x ){\r\n\t\r\n\tif ( x != '' ) {\r\n\t\tvar pprf_original_height = jQuery( x + ' html #wpbody-content').height() + 60;\r\n\t\r\n\t\tjQuery('#' + x).height( jQuery('#' + x).height() ).animate({height: pprf_original_height }, 500);;\r\n\r\n\t}\r\n}\r\n\r\nfunction pprf_update_parent_iframe( x ){\r\n\t\r\n\tif ( x != '') {\r\n\t\t\r\n\t\tvar y = jQuery('#' + x + ' html #wpbody-content').height();\r\n\t\t// 4px is the small gap at the bottom\r\n\t\tjQuery('#' + x).height( jQuery('#' + x).height() ).animate({height: y }, 500);\r\n\r\n\t}\r\n}\r\nvar pprf_parent_height = jQuery('html').height();\r\n/**\r\n * insert a new row to the page after adding a new item\r\n */\r\nfunction pprf_new( podid, postid, cpodid, authorid , iframeid, poditemid, parent_name ){ \r\n\tif( jQuery.isNumeric( podid ) && jQuery.isNumeric( cpodid ) && jQuery.isNumeric( authorid ) && jQuery.isNumeric( poditemid ) ) {\r\n\t\t\r\n\t\tvar para_obj = { 'podid': podid, 'postid': postid, 'cpodid': cpodid, 'authorid': authorid, 'poditemid' : poditemid, 'action' : 'admin_pprf_load_newly_added', 'security' : ajax_script.nonce };\r\n\t\r\n\t\tvar data_obj = para_obj;\r\n\t\t\r\n\t\tjQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-' + 'loader' ).removeClass('hidden');\t\t\t\r\n\t\tjQuery.post(\r\n\t\t\tajax_script.ajaxurl, \r\n\t\t\tdata_obj, \r\n\t\t\tfunction( responses ){\t\r\n\t\t\t\tjQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-' + 'loader' ).addClass('hidden');\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tvar response_data = responses['data'];\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t//console.log( response_data );\r\n\t\t\t\tif( responses['success'] === true && typeof response_data['id'] !== 'undefined' && jQuery.isNumeric( response_data['id'] ) ){\r\n\r\n\t\t\t\t\tvar\tiframe_build\t\t= pprf_build_item_html( response_data, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name, false );\r\n\t\t\t\t\t\r\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list' ).append( iframe_build ); \r\n\t\t\t\t\t// if entries limit, toggle the add new \r\n\t\t\t\t\tvar items_left_count\t= jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li').length;\r\n\t\t\t\t\tvar limit_int\t=\tparseInt( jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-entry-limit' ).val() );\r\n\t\t\t\t\tif( limit_int != 0 && items_left_count >= limit_int ){\r\n\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new' ).addClass('hidden');\t\t\t\t\t\t\t\r\n\t\t\t\t\t}\t\t\t\t\t\t\r\n\r\n\t\t\t\t}\r\n\t\t\t\t// if add a new one, activeate the live items tab\r\n\t\t\t\tjQuery( '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab .dashicons-portfolio').click();\t\r\n\t\t\t\t//jQuery( document ).on('click', '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab .dashicons-portfolio' );\r\n\t\t\t\t\r\n\t\t\t\tpprf_odd_even_color( cpodid + '-' + poditemid );\r\n\t\t\t}\r\n\t\t);\t\r\n\t}\r\n}\r\n\r\nfunction pprf_build_item_html( items, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name, is_repeated ){\r\n\tif( typeof items['id'] == 'undefined' || !jQuery.isNumeric( items['id'] ) || !jQuery.isNumeric( podid ) ){\r\n\t\treturn '';\r\n\t}\r\n//console.log(items);\r\n\tvar trashed_css\t\t= '';\r\n\tvar btn_trashed_css\t= 'pprf-btn-delete';\r\n\tvar display_style\t= '';\r\n\tvar edit_icon_css\t= 'dashicons-edit';\r\n\r\n\tif( jQuery('#panda-repeater-trash-info-' + cpodid + '-' + poditemid ).data('enable-trash') == 1 ){\t\t\r\n\t\tif( typeof items['trashed'] != 'undefined' && items['trashed'] == 1 ){\r\n\t\t\t\r\n\t\t\ttrashed_css \t= 'pprf-trashed';\r\n\t\t\tbtn_trashed_css\t= 'pprf-btn-trashed';\r\n\t\t\t// if the portfolio foder is open, hide the trash one\r\n\t\t\tedit_icon_css\t= 'dashicons-update ';\t\r\n\t\t\tif( jQuery('#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab.active .dashicons').hasClass('dashicons-portfolio') ) {\r\n\t\t\t\tdisplay_style\t\t= 'display:none;';\r\n\t\t\t}\t\t\r\n\t\t\t\t\r\n\t\t} else {\r\n\t\t\ttrashed_css\t\t= 'pprf-not-trashed';\r\n\t\t\tbtn_trashed_css\t= 'pprf-btn-not-trashed';\r\n\t\t\tif( jQuery('#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab.active .dashicons').hasClass('dashicons-trash') ) {\r\n\t\t\t\tdisplay_style\t\t= 'display:none;';\r\n\t\t\t}\t\t\t\t\r\n\t\t}\r\n\t}\t\r\n\tvar repeated_css_append\t=\t'';\r\n\tif( is_repeated == true ){\r\n\t\trepeated_css_append\t=\t'-repeated';\r\n\t}\r\n\tvar delete_action \t= '';//jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + '-' + 'add-new .pprf-trash-btn' ).data('target');\r\n\tvar ids_in_css\t \t= cpodid + '-' + items['id'] + '-' + poditemid;\r\n\tvar responding_id \t= items['id'];\r\n\tvar the_title\t \t= items['title'];\r\n\tvar the_label\t\t= the_title;\r\n\t//var the_label\t\t= '<strong>ID:</strong> ' + responding_id + ' <strong>' + items['pprf_name_label'] + ': </strong> ' + the_title;\r\n\tif( typeof items['label'] != 'undefined' && items['label'] != '' ){\r\n\t\tthe_label\t=\titems['label'];\r\n\t}\r\n\tvar next_background_css\t= jQuery('#next-bg').data('bg');\r\n\tvar full_url\t \t\t= PANDA_PODS_REPEATER_PAGE_URL[0] + 'iframe_id=panda-repeater-edit-' + ids_in_css + '&podid=' + podid + '&tb=' + cpodid + '&postid=' + postid + '&itemid=' + responding_id + '&poditemid=' + poditemid;\t\r\n\tvar html_build \t\t=\t\r\n\t '<li data-id=\"' + responding_id + '\" class=\"' + trashed_css + '\" id=\"li-' + ids_in_css + repeated_css_append + '\" style=\"' + display_style + '\">' +\r\n\t\t'<div class=\"pprf-row w100 pprf-left\">' + \r\n\t\t\t'<div class=\"w100 pprf-left\" id=\"pprf-row-brief-' + ids_in_css + repeated_css_append + '\">' +\r\n\t\t\t\t'<div class=\"pprf-left pd8 pprf-left-col ' + next_background_css + ' \">' + the_label + '</div>';\r\n\r\n\tif( is_repeated == true ){\r\n\t\t\thtml_build +=\t\r\n\t\t\t\t\t\t'<div class=\"button pprf-right-col center pprf-dismiss-btn ' + delete_action + ' ' + btn_trashed_css + '\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' + \r\n\t\t\t\t\t\t\t'<span class=\"dashicons dashicons-dismiss pdt6 mgb0 \"></span>' +\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t'</div>' +\t\r\n\t\t\t\t\t\t'<div class=\"pprf-left pd8\">Repeated</div>';\t\t\t\r\n\t} else {\r\n\t\thtml_build +=\t\t\t\t\r\n\t\t\t\t'<div class=\"button pprf-right-col center pprf-trash-btn ' + delete_action + ' ' + btn_trashed_css + '\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' + \r\n\t\t\t\t\t'<span class=\"dashicons dashicons-trash pdt6 mgb0 \"></span>' +\r\n\t\t\t\t\t'<div id=\"panda-repeater-trash-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\r\n\t\t\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_URL[0] + '/images/dots-loading.gif\" alt=\"loading\" class=\"mgl8 loading pprf-left\"/>' +\r\n\t\t\t\t\t'</div>' +\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t'</div>' +\t\r\n\t\t\t\t'<div class=\"button pprf-right-col center pprf-save-btn\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' +\r\n\t\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_URL[0] + 'images/save-icon-tran.png\" class=\"pprf-save-icon mgt8 mgb2\"/>' + \t\r\n\t\t\t\t\t'<div id=\"panda-repeater-save-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\r\n\t\t\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_URL[0] + 'images/dots-loading.gif\" alt=\"loading\" class=\"mgl8 pprf-left\"/>' +\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t'</div>' +\r\n\t\t\t\t'</div>' +\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t'<div class=\"button pprf-edit pprf-row-load-iframe alignright pprf-right-col center pprf-edit-btn\" role=\"button\" data-target=\"' + ids_in_css + '\" data-url=\"' + full_url + '\">' +\r\n\t\t\t\t\t'<span class=\"dashicons ' + edit_icon_css + ' pdt8 mgb0 pprf-edit-span\"></span>' +\r\n\t\t\t\t\t'<div id=\"panda-repeater-edit-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\r\n\t\t\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_URL[0] + '/images/dots-loading.gif\" alt=\"loading\" class=\"mgl9 pprf-left\"/>' +\r\n\t\t\t\t\t'</div>\t' +\r\n\t\t\t\t'</div>';\r\n\t}\r\n\thtml_build +=\t\t\t\t\t\t\t\t\r\n\t\t\t'</div>' +\t\t\t\t\t\t\t\t\t\t \r\n\t\t\t'<div>' + \r\n\t\t\t\t'<iframe id=\"panda-repeater-edit-' + ids_in_css + '\" frameborder=\"0\" scrolling=\"no\" src=\"\" style=\"display:none; \" class=\"panda-repeater-iframe w100\"></iframe>' + \r\n\t\t\t\t'<div id=\"panda-repeater-edit-expand-' + ids_in_css + '\" class=\"w100 pprf-left center pdt3 pdb3 pprf-expand-bar pprf-edit-expand\" data-target=\"' + ids_in_css + '\" style=\"display:none;\">Content missing? Click here to expand</div>' + \r\n\t\t\t'</div>' +\r\n\t \t '</div>' +\r\n\t\t'</li>'\r\n\t ;\r\n\tif( next_background_css == 'pprf-purple-bg' ){\r\n\t\tjQuery('#next-bg').data('bg', 'pprf-white-bg');\r\n\t} else {\r\n\t\tjQuery('#next-bg').data('bg', 'pprf-purple-bg');\t\t\t\t\t\t\r\n\t}\t \r\n\treturn html_build; \r\n}\r\n/**\r\n * delete an item\r\n */\r\nfunction pprf_delete_item( podid, postid, cpodid, itemid, authorid , iframeid, poditemid, trashed ){\r\n\t\r\n\tif( jQuery.isNumeric( podid ) && jQuery.isNumeric( cpodid ) && jQuery.isNumeric( authorid ) && jQuery.isNumeric( itemid ) && jQuery.isNumeric( poditemid ) ) {\r\n\t\t\r\n\t\tvar para_obj \t= { 'podid': podid, 'postid': postid, 'cpodid': cpodid, 'itemid' : itemid, 'authorid': authorid, 'poditemid' : poditemid, 'action' : 'admin_pprf_delete_item', 'trash' : trashed, 'security' : ajax_script.nonce };\r\n\t\tvar info_text\t=\t'';\r\n\t\tif( trashed == 0 ){\r\n\t\t\tinfo_text\t=\tstrs_obj.be_restored;\r\n\t\t}\t\t\r\n\t\tif( trashed == 1 ){\r\n\t\t\tinfo_text\t=\tstrs_obj.can_recover;\r\n\t\t}\r\n\t\tif( trashed == 2 ){\r\n\t\t\tinfo_text\t=\tstrs_obj.be_deleted;\r\n\t\t}\r\n\t\t//panda-repeater-edit-13-506 236\r\n\t\tvar data_obj = para_obj;\r\n\t\tvar passt_bln = confirm( strs_obj.you_sure + ' ' + info_text );\r\n\t\t//$('#overlord').removeClass('hidden');\t\t\r\n\t\t\r\n\t\tif( passt_bln == true ){\r\n\r\n\t\t\tif( trashed == 0 ){\r\n\t\t\t\tjQuery( '#panda-repeater-edit-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).removeClass('hidden');\r\n\t\t\t} else {\t\t\t\t \r\n\t\t\t\tjQuery( '#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).removeClass('hidden');\r\n\t\t\t}\r\n\t\t\t//jQuery( '#pprf-row-brief-' + cpodid + '-' + itemid + '-' + poditemid + ' .pprf-trash-btn .dashicons-trash' ).remove( );\r\n\t\t\tjQuery.post(\r\n\t\t\t\tajax_script.ajaxurl, \r\n\t\t\t\tdata_obj, \r\n\t\t\t\tfunction( responses ){\t\r\n\t\t\t\t\tif( responses['success'] === true ){\r\n\t\t\t\t\t\tvar response_data = responses['data'];\r\n\t\t\t\t\t\tif( response_data.length != 0 ){\r\n\t\t\t\t\t\t\tvar ids_in_css\t=\tcpodid + '-' + itemid + '-' + poditemid;\r\n\t\t\t\t\t\t\tvar exp_str\t\t= 'panda-repeater-edit-expand-' + ids_in_css;\r\n\t\t\t\t\t\t\tvar iframe_build \t= 'panda-repeater-edit-' + ids_in_css;\t\t\r\n\r\n\t\t\t\t\t\t\tif( trashed == 0 ){\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-edit-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).addClass('hidden');\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).addClass('hidden');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t//jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' #' + iframeid ).remove( );\r\n\t\t\t\t\t\t\tif( trashed == 0 ){\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span').removeClass('dashicons-update');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span').addClass('dashicons-edit')\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).removeClass('pprf-trashed');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).addClass('pprf-not-trashed');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).css('display', 'none');\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn').addClass('pprf-btn-not-trashed');\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn').removeClass('pprf-btn-trashed');\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif( jQuery.trim( jQuery('#' + iframe_build ).contents().find(\"body\").html() ) != '' ) {\r\n\t\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-save-btn .pprf-save-icon').attr('src', PANDA_PODS_REPEATER_URL[0] + 'images/save-icon.png');\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif( trashed == 1 ){\r\n\r\n\r\n\t\t\t\t\t\t\t\tif( jQuery('#' + iframe_build ) != 'undefined' ){\r\n\t\t\t\t\t\t\t\t\tjQuery('#' + iframe_build ).hide();\t\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif( jQuery('#' + exp_str ) != 'undefined' ){\r\n\t\t\t\t\t\t\t\t\tjQuery('#' + exp_str ).hide();\t\r\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tjQuery('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).removeClass('dashicons-arrow-up');\r\n\t\t\t\t\t\t\t\tjQuery('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).addClass('dashicons-edit');\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).removeClass('pprf-not-trashed');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).addClass('pprf-trashed');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).css('display', 'none');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).addClass('dashicons-update');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).removeClass('dashicons-edit');\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn').addClass('pprf-btn-trashed');\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn').removeClass('pprf-btn-not-trashed');\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-save-btn .pprf-save-icon').attr('src', PANDA_PODS_REPEATER_URL[0] + 'images/save-icon-tran.png');\r\n\t\t\t\t\t\t\t\t\r\n\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif( trashed == 2 ){\t\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' #' + iframeid ).parent().parent().remove( );\r\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).remove( );\r\n\t\t\t\t\t\t\t\t// if entries limit, toggle the add new \r\n\t\t\t\t\t\t\t\tvar items_left_count\t= jQuery('#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li').length;\r\n\t\t\t\t\t\t\t\tvar limit_int\t=\tparseInt( jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-entry-limit' ).val() );\r\n\t\t\t\t\t\t\t\tif( limit_int != 0 && items_left_count < limit_int ){\r\n\t\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new' ).removeClass('hidden');\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t// integrate with simpods js\r\n\t\t\t\t\t\t\t\tif( typeof call_simpods !== 'undefined' && jQuery.isFunction( call_simpods ) ) {\r\n\t\t\t\t\t\t\t\t\tcall_simpods( responses );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t//document.getElementById( iframeid ).contentWindow.pprf_resize_window() ;\r\n\t\t\t\t\t\t\t pprf_odd_even_color( cpodid + '-' + poditemid );\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t);\t\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n}\r\n//jQuery('.pprf-redorder-btn').click( function(){\r\njQuery( document ).on('click', '.pprf-redorder-btn',\tfunction( evt ){\t\t\r\n\tvar id = jQuery( this ).data('id');\r\n\tjQuery( this ).addClass('hidden');\t\r\n\tjQuery( this ).parent().children('.pprf-save-redorder-btn').removeClass('hidden');\t\r\n\tjQuery( this ).parent().children('.pprf-redorder-list-wrap').removeClass('hidden');\r\n\tjQuery( this ).parent().children('.pprf-row').addClass('hidden');\t\r\n\tjQuery( '#' + id + '-add-new' ).addClass('hidden');\t\r\n});\r\n\r\n//jQuery('.pprf-save-redorder-btn').click( function(){\r\njQuery( document ).on('click', '.pprf-save-redorder-btn',\tfunction( evt ){\t\r\n\tvar id = jQuery( this ).data('id');\r\n\tjQuery( this ).addClass('hidden');\t\r\n\tjQuery( this ).parent().children('.pprf-redorder-list-wrap').addClass('hidden');\t\r\n\tjQuery( this ).parent().children('.pprf-save-redorder-btn').addClass('hidden');\r\n\tjQuery( this ).parent().children('.pprf-redorder-btn').removeClass('hidden');\r\n\tjQuery( this ).parent().children('.pprf-row').removeClass('hidden');\t\r\n\tjQuery( '#' + id + '-add-new' ).removeClass('hidden');\t\r\n});\r\n /**\r\n * load more\r\n */\r\n//jQuery('.pprf-load-more-btn').click( function( evt ){\r\njQuery( document ).on('click', '.pprf-load-more-btn',\tfunction( evt ){\r\n\tevt.preventDefault();\r\n\tjQuery( '#pprf-load-more-wrap-' + jQuery( this ).data('target') + ' .pprf-ajax-img').css('display', 'block');\r\n\t\r\n\r\n\tpprf_load_more( jQuery( this).data('target'), jQuery( this ) );\r\n\r\n})\t \r\n\r\nfunction pprf_load_more( target_str, ele_obj ){\r\n\tvar loaded_arr\t=\tnew Array();\r\n\tjQuery( '#panda-repeater-fields-' + target_str + ' .pprf-redorder-list li' ).each( function( idx_int ) {\r\n\t\tloaded_arr[ idx_int ] = parseInt( jQuery( this ).data('id') );\r\n\t});\r\n\t\r\n\tvar data_obj = {\r\n\t\taction \t\t: \t'admin_pprf_load_more',\r\n\t\tloaded \t\t:\tloaded_arr, \r\n\t\tsecurity \t: \tajax_script.nonce,\r\n\t\tpod_id\t\t: \tele_obj.data('podid'),\r\n\t\tpost_id\t\t: \tele_obj.data('postid'),\r\n\t\tsaved_tb\t: \tele_obj.data('tb'),\r\n\t\tiframe_id \t: \tele_obj.data('iframe_id'),\r\n\t\tpod_item_id\t: \tele_obj.data('poditemid'),\r\n\t\tauthorid\t: \tele_obj.data('userid'),\r\n\t\tcp_title\t: \tele_obj.data('cptitle'),\r\n\t\ttrashable\t: \tele_obj.data('enable-trash'),\r\n\t\torder\t\t: \tele_obj.data('order'),\r\n\t\torder_by\t: \tele_obj.data('order-by'),\r\n\t\tamount\t\t: \tjQuery('#panda-repeater-amount-' + target_str ).val(),\r\n\t\tstart\t\t: \tjQuery('#panda-repeater-start-from-' + target_str ).val()\r\n\t};\r\n\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-load-more-report' ).text( '' );\r\n\tjQuery.post(\r\n\t\tajax_script.ajaxurl, \r\n\t\tdata_obj, \r\n\t\tfunction( response_obj ){\r\n\t\t\tvar html_build\t=\t'';\r\n\t\t\tif( response_obj.success == true ){\r\n\t\t\t\tvar trashed_count\t\t=\t0;\r\n\t\t\t\t//var not_trashed_count\t=\t0;\r\n\t\t\t\tfor( var i = 0; i < response_obj.data.length; i ++ ){\t\r\n\t\t\t\t\tvar is_repeated\t=\tfalse;\r\n\r\n\t\t\t\t\tif( jQuery( '#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load' ).val() == 'append_to' ){ // only need to check repeatition if it is on Append To.\r\n\t\t\t\t\t\tfor( var j = 0; j < loaded_arr.length; j ++ ){\t//inArry doesn't work\r\n\t\t\t\t\t\t\tif( parseInt( response_obj.data[ i ]['id'] ) == loaded_arr[ j ] ){\r\n\t\t\t\t\t\t\t\tis_repeated\t=\ttrue;\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t}\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\r\n\t\t\t\t\thtml_build += pprf_build_item_html( response_obj.data[ i ], data_obj.pod_id, data_obj.post_id, data_obj.saved_tb, data_obj.authorid , data_obj.iframe_id, data_obj.pod_item_id, data_obj.cp_title, is_repeated )\r\n\t\t\t\t\tif( response_obj.data[ i ]['trashed'] == 1 ){\r\n\t\t\t\t\t\ttrashed_count ++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tvar info_text\t=\tresponse_obj.data.length;\r\n\t\t\t\tif( data_obj.trashable == 1 ){\r\n\t\t\t\t\tinfo_text\t=\t( parseInt( response_obj.data.length ) - trashed_count ) + ' published, ' + trashed_count + ' trashed.';\r\n\t\t\t\t}\r\n\t\t\t\tif( jQuery( '#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load' ).val() == 'append_to' ){\r\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + data_obj.saved_tb + '-' + data_obj.pod_item_id + ' .pprf-redorder-list' ).append( html_build ); \r\n\t\t\t\t} else {\r\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + data_obj.saved_tb + '-' + data_obj.pod_item_id + ' .pprf-redorder-list' ).html( html_build ); \r\n\t\t\t\t}\r\n\t\t\t\tpprf_odd_even_color( data_obj.saved_tb + '-' + data_obj.pod_item_id );\r\n\t\t\t\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-ajax-img').css('display', 'none');\r\n\r\n\t\t\t\tif( response_obj.data.length != 0 ){\r\n\t\t\t\t\tjQuery('#panda-repeater-start-from-' + target_str ).val( parseInt( data_obj.start ) + parseInt( response_obj.data.length ) );\r\n\t\t\t\t}\r\n\r\n\t\t\t\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-load-more-report' ).text( ' | Loaded ' + info_text );\r\n\t\t\t}\r\n\r\n\t\t\t//pprf_build_item_html( items, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name )\r\n\t\t\t//pprf_new( ele_obj.data('podid'), ele_obj.data('postid'), ele_obj.data('tb'), ele_obj.data('userid'), ele_obj.data('iframe_id'), ele_obj.data('pod_item_id'), ele_obj.data('cptitle') );\r\n\r\n\t\t}\r\n\t);\r\n}\t\r\n/**\r\n * reset colours for each row\r\n */\r\n\r\nfunction pprf_odd_even_color( ids ){\r\n\r\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col').removeClass('pprf-purple-bg');\r\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col').removeClass('pprf-white-bg');\r\n\t\r\n\tif( jQuery( '#panda-repeater-fields-tabs-' + ids ).length == 0 ){\r\n\t\t\r\n\t\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col').each( function( idx ) {\r\n\t\t\tif( idx % 2 == 0 ){\r\n\t\t\t\tjQuery( this ).addClass('pprf-white-bg');\r\n\t\t\t} else {\r\n\t\t\t\tjQuery( this ).addClass('pprf-purple-bg');\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-not-trashed').each( function( idx ) {\r\n\t\tif( idx % 2 == 0 ){\r\n\t\t\tjQuery( this ).children('.pprf-row').children().children('.pprf-left-col').addClass('pprf-white-bg');\r\n\t\t} else {\r\n\t\t\tjQuery( this ).children('.pprf-row').children().children('.pprf-left-col').addClass('pprf-purple-bg');\r\n\t\t}\r\n\t});\r\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-trashed').each( function( idx ) {\r\n\t\tif( idx % 2 == 0 ){\r\n\t\t\tjQuery( this ).children('.pprf-row').children().children('.pprf-left-col').addClass('pprf-white-bg');\r\n\t\t} else {\r\n\t\t\tjQuery( this ).children('.pprf-row').children().children('.pprf-left-col').addClass('pprf-purple-bg');\r\n\t\t}\r\n\t});\t\r\n}\r\n/**\r\n * if reassigned successfully, remove the item and reset colours\r\n */\r\nfunction pprf_reassign( cpodid, poditemid, itemid ){\r\n\t//console.log( cpodid, poditemid, itemid );\r\n\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).remove( );\r\n\t//document.getElementById( iframeid ).contentWindow.pprf_resize_window() ;\r\n\tpprf_odd_even_color( cpodid + '-' + poditemid );\r\n}\r\njQuery(document).ready( function($) {\r\n\t\t\r\n\t/**\r\n\t * fix_helper_modified for drag and drop\r\n\t */\r\n\tvar fix_helper_modified = function(e, tr) {\r\n\t\tvar $originals = tr.children();\r\n\t\tvar $helper = tr.clone();\r\n\t\t$helper.children().each(function(index) {\r\n\t\t\t$(this).width($originals.eq(index).width());\t\t\t\t\t\r\n\t\t});\r\n\t\t\r\n\t\treturn $helper;\r\n\t},\r\n\tupdate_index = function(e, ui) {\r\n\t\tvar the_order = $(this).sortable('toArray');\r\n\r\n\t\tvar data_obj = {\r\n\t\t\taction: 'admin_pprf_update_order',\r\n\t\t\torder: \t the_order, \r\n\t\t\tsecurity : ajax_script.nonce\r\n\t\t};\r\n\r\n\t\t$.post(\r\n\t\t\tajax_script.ajaxurl, \r\n\t\t\tdata_obj, \r\n\t\t\tfunction( resp_arr ){\t\t\t\t\r\n\t\t\t\tpprf_odd_even_color( resp_arr.data.pprf_id );\r\n\t\t\t}\r\n\t\t)\t\t\t\t\r\n\t};\t\r\n\r\n\tif( $('.pprf-redorder-list.pandarf_order').length != 0 ){\r\n\t\t$('.pprf-redorder-list.pandarf_order').sortable({\r\n\t\t\thelper: fix_helper_modified,\r\n\t\t\tcursor: 'move',\r\n\t\t\topacity: 0.7,\r\n\t\t\ttolerance: 'intersect',\t\t\r\n\t\t\tupdate: \t\tupdate_index,\r\n\t\t\tcancel: \t\t'.pprf-row-load-iframe, .pprf-save-btn, pprf-trash-btn',\r\n\t\t\thandle: \t\t'.pprf-left-col'\r\n\t\t});\t\t\r\n\t}\r\n\r\n\t$(document.body).on('click', '.pprf-row-load-iframe', function( e ){\t\r\n\t\te.stopPropagation();\r\n\t\tvar url_str \t= $( this ).data('url');\r\n\t\tvar ids_in_css\t \t= $( this ).data('target');\r\n\t\tvar exp_str\t\t= 'panda-repeater-edit-expand-' + ids_in_css;\r\n\t\tvar iframe_build \t= 'panda-repeater-edit-' + ids_in_css;\t\t\r\n\t\tvar trash_ele\t= $( this ).parent().children('.pprf-trash-btn');\r\n\t\tif( $( this ).children('.pprf-edit-span').hasClass('dashicons-update') ){ \r\n\t\t\t// restore this item\t\t\r\n\t\t\tpprf_delete_item( trash_ele.data('podid'), trash_ele.data('postid'), trash_ele.data('tb'), trash_ele.data('itemid'), trash_ele.data('userid'), trash_ele.data('iframe_id'), trash_ele.data('poditemid'), 0 );\r\n\t\t} else { \r\n\t\t\tvar addEdit_str\t= ' .pprf-edit';\t\r\n\t\t\tif( $( this ).hasClass('pprf-add') ){\r\n\t\t\t\taddEdit_str\t= '.pprf-add';\t\r\n\t\t\t\tiframe_build \t= 'panda-repeater-add-new-' + ids_in_css;\r\n\t\t\t\texp_str\t\t= 'panda-repeater-add-new-expand-' + ids_in_css;\r\n\t\t\t}\t\r\n\t\t\t\r\n\t\t\tif( $('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass('dashicons-edit') ){\t\t\r\n\t\t\t\t\r\n\t\t\t\t//if iframe not loaded\r\n\t\t\t\t\r\n\t\t\t\tif( $('#' + iframe_build ).attr('src') == '' ){\r\n\t\t\t\t\t$('#' + iframe_build ).attr('src', url_str ); \r\n\t\t\t\t\t$('#' + iframe_build + '-' + 'loader' ).removeClass('hidden');\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t$('#' + iframe_build ).show('slow',function(){\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).addClass('dashicons-arrow-up');\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).removeClass('dashicons-edit');\t\t\r\n\t\t\t\t});\r\n\t\t\t\t$('#' + exp_str ).show();\t\r\n\t\t\t\t$('#' + iframe_build ).on('load', function(){\r\n\t\t\t\t\t\r\n\t\t\t\t\t$('#' + iframe_build + '-' + 'loader' ).addClass('hidden');\t\r\n\t\t\t\t\t//change icon\t\r\n\t\t\t\t\t$('#panda-repeater-save-' + ids_in_css + '-' + 'loader' ).parent().children('.pprf-save-icon').attr('src', PANDA_PODS_REPEATER_URL[0] + '/images/save-icon.png');\r\n\t\t\t\t\t$('#panda-repeater-save-' + ids_in_css + '-' + 'loader' ).parent().addClass('pprf-btn-ready');\r\n\t\t\t\t\t$('#panda-repeater-save-' + ids_in_css + '-' + 'loader' ).addClass('hidden');\r\n\t\t\t\t\t//$('#pprf-row-brief-' + ids_in_css + '' ).addClass('hidden');\t\r\n\t\t\t\t\t//$('#' + iframe_build )[0].contentWindow.pprf_resize_window();\r\n\t\t\t\t\t//console.log( $(this).parent().height() );\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).addClass('dashicons-arrow-up');\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).removeClass('dashicons-edit');\t\t\t\t\t\t\r\n\t\t\t\t});\t\r\n\t\t\t//\tif( $('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass('dashicons') ){\t\r\n\r\n\t\t\t\t//}\r\n\t\t\t} else {\r\n\t\t\t\t\r\n\t\t\t\t$('#' + iframe_build ).hide('slow',function(){\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).removeClass('dashicons-arrow-up');\r\n\t\t\t\t\t$('#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).addClass('dashicons-edit');\t\r\n\t\t\t\t});\t\r\n\t\t\t\t$('#' + exp_str ).hide();\t\t\t\t\t\r\n\t\t\t//\tif( $('#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass('dashicons') ){\t\r\n\t\t\t\t\t\t\r\n\t\t\t//\t}\r\n\t\t\t}\r\n\t\t\t$('#pprf-row-brief-' + ids_in_css + ' .dashicons-trash' ).removeClass('dashicons-arrow-up');\r\n\t\t}\r\n\t\t\r\n\t});\t\r\n\t/**\r\n\t * click to explan its iframe\r\n\t */\t\r\n\t$( document.body ).on('click', '.pprf-expand-bar', function(){\t\t\t\t\r\n\t\tvar ids\t \t= $( this ).data('target');\r\n\t\tvar iframe \t= 'panda-repeater-edit-' + ids;\r\n\t\tif( $( this ).hasClass('pprf-add-expand') ){\r\n\t\t\tiframe \t= 'panda-repeater-add-new-' + ids;\t\t\t\r\n\t\t}\t\r\n\t\tif( typeof document.getElementById( iframe ) != 'undefined' ){\r\n\t\t\t\r\n\t\t\tif( typeof document.getElementById( iframe ).contentWindow.pprf_resize_window != 'undefined' ){ \r\n\t\t\t\tdocument.getElementById( iframe ).contentWindow.pprf_resize_window();\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\t/**\r\n\t * click to delete\r\n\t */\t \r\n\t$( document.body ).on('click', '.pprf-trash-btn', function( e ){\t\t\r\n\t\te.stopPropagation();\r\n\t\tvar ids\t \t= $( this ).data('target');\r\n\t\tvar iframe \t= 'panda-repeater-edit-' + ids;\r\n\t\tif( $( this ).hasClass('pprf-add-expand') ){\r\n\t\t\tiframe \t= 'panda-repeater-add-new-' + ids;\t\t\t\r\n\t\t}\t\r\n\t\tvar trash\t= 0;\r\n\t\tif( $( this ).hasClass('pprf-btn-not-trashed') ){\r\n\t\t\ttrash\t= 1;\r\n\t\t}\r\n\t\tif( $( this ).hasClass('pprf-btn-trashed') ){\r\n\t\t\ttrash\t= 2;\r\n\t\t}\t\r\n\t\tif( $( this ).hasClass('pprf-btn-delete') ){\r\n\t\t\ttrash\t= 2;\r\n\t\t}\t\t\t\t\t\t\r\n\t\tpprf_delete_item( $( this ).data('podid'), $( this ).data('postid'), $( this ).data('tb'), $( this ).data('itemid'), $( this ).data('userid'), $( this ).data('iframe_id'), $( this ).data('poditemid'), trash );\r\n\t })\r\n\t \t \r\n\t$(document.body).on('click', '.pprf-save-btn', function( e ){\t\t\r\n\t\t e.stopPropagation();\t\r\n\t\t if( $( this ).hasClass( 'pprf-btn-ready' ) ){\r\n\t\t\tvar ids\t\t= $( this ).data('target');\r\n\t\t\tvar iframe \t= 'panda-repeater-edit-' + ids;\r\n\t\t\tif( $( this ).hasClass('pprf-save-new-btn') ){\r\n\t\t\t\tiframe \t= 'panda-repeater-add-new-' + ids;\r\n\t\t\t}\t\t\t \r\n\t\t\t$('#panda-repeater-save-' + ids + '-loader' ).removeClass('hidden');\r\n\t\t\t\r\n\t\t\t$('#' + iframe ).contents().find('.pods-submit-button').trigger( \"click\" );\t\r\n\t\t\tpprf_is_changed\t=\tfalse;\t\t\r\n\r\n\t\t }\r\n\t });\r\n\t /**\r\n\t * if a pods is is clicked, flag it as saved\r\n\t */\r\n\t $('.toplevel_page_panda-pods-repeater-field .pods-field-input').on('click keyup change', function(){\r\n\t\t pprf_is_changed\t=\ttrue;\r\n\t });\r\n\r\n\r\n\t$( document ).on('click', '#publishing-action .button, #save-action .button', function(){\t\t\t\t\r\n\t\t if( pprf_is_changed ){\r\n\t\t\tevt.preventDefault();\r\n\t\t\tvar leave = confirm( strs_obj.Ignore_changes );\r\n\t\t\tif ( leave == true){\r\n\t\t\t\tpprf_is_changed\t=\tfalse;\r\n\t\t\t\t//$( this ).click();\r\n\t\t\t\t$( this ).trigger('click');\r\n\t\t\t} \r\n\t\t\tif ( leave == false){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t }\r\n\t });\r\n\r\n\t /**\r\n\t * toggle trashed and current\r\n\t */\t\r\n\t$(document.body).on('click', '.pprf-tab .dashicons-trash', function(){\t\t\t\r\n\t \t\r\n\t \t$( '#panda-repeater-fields-' + $( this).parent().data('target') + ' .pprf-trashed').css('display', 'block');\r\n\t \t$( '#panda-repeater-fields-' + $( this).parent().data('target') + ' .pprf-not-trashed').css('display', 'none');\r\n\t \t$( this ).parent().parent().children('.active').removeClass('active');\r\n\t \t$( this ).parent().addClass('active');\r\n\t \tpprf_odd_even_color( $( this).parent().data('target') );\r\n\r\n\t})\t\r\n\t$(document.body).on('click', '.pprf-tab .dashicons-portfolio', function(){\t\t\t\r\n\t \t$( '#panda-repeater-fields-' + $( this).parent().data('target') + ' .pprf-trashed').css('display', 'none');\r\n\t \t$( '#panda-repeater-fields-' + $( this).parent().data('target') + ' .pprf-not-trashed').css('display', 'block');\r\n\t \t$( this ).parent().parent().children('.active').removeClass('active');\r\n\t \t$( this ).parent().addClass('active');\t \t\r\n\t \tpprf_odd_even_color( $( this).parent().data('target') );\r\n\t})\t \r\n \r\n \t/**\r\n \t * remove repeated\r\n \t */ \t\r\n \t$(document.body).on('click', '.pprf-dismiss-btn', function(){\t\r\n \t\t$('#li-' + $( this ).data('target') + '-repeated' ).remove();\r\n \t})\r\n});\r\n \r\nvar pprf_is_changed\t=\tfalse;\t"]}1 {"version":3,"sources":["admin.js"],"names":["pprf_resize_iframe","obj","style","height","contentWindow","document","body","scrollHeight","pprf_update_iframe_size","x","y","jQuery","animate","pprf_update_size","pprf_original_height","pprf_update_parent_iframe","pprf_parent_height","pprf_new","podid","postid","cpodid","authorid","iframeid","poditemid","parent_name","data_obj","isNaN","action","security","ajax_script","nonce","removeClass","post","ajaxurl","responses","para_obj","response_data","iframe_build","pprf_build_item_html","append","length","items_left_count","limit_int","parseInt","val","addClass","click","pprf_odd_even_color","items","is_repeated","trashed_css","btn_trashed_css","display_style","edit_icon_css","data","hasClass","repeated_css_append","ids_in_css","the_label","responding_id","next_background_css","full_url","PANDA_PODS_REPEATER_PAGE_URL","PANDA_PODS_REPEATER_CONSTANTS","html_build","url","pprf_delete_item","itemid","info_text","trashed","strs_obj","be_deleted","trash","confirm","be_restored","can_recover","exp_str","contents","html","hide","css","trim","find","attr","parent","remove","call_simpods","isFunction","children","pprf_load_more","target_str","ele_obj","loaded_arr","i","each","idx_int","loaded","pod_id","post_id","saved_tb","pod_item_id","response_obj","trashed_count","trashable","order","order_by","amount","start","text","success","data_length","j","loaded_length","iframe_id","cp_title","ids","pprf_reassign","idx","this","ready","$originals","$helper","$","width","the_order","resp_arr","cursor","tolerance","cancel","on","evt","id","preventDefault","sortable","helper","e","tr","clone","trash_ele","eq","index","pprf_id","handle","addEdit_str","url_str","iframe","pprf_resize_window","stopPropagation","show","pprf_is_changed","getElementById","Ignore_changes","trigger","leave"],"mappings":"aAYA,SAAAA,mBAAAC,GACAA,EAAAC,MAAAC,OAAAF,EAAAG,cAAAC,SAAAC,KAAAC,aAAA,KAMA,SAASC,wBAAyBC,EAAGC,GAE1B,IAALD,GACJE,OAAM,IAAEF,GAAUN,OAAQQ,OAAQ,IAARF,GAAkBN,UAAWS,QAAS,CAAAT,OAAAO,GAAA,KAChE,SAAAG,iBAAAJ,GAID,IAFDK,EAEW,IAALL,IAFNK,EAA8BH,OAAAF,EAAA,yBAAAN,SAAA,GAG5BQ,OAAIG,IAAAA,GAAAA,OAAoBH,OAAGA,IAAYF,GAAAN,UAAAS,QAAZ,CAAsCT,OAAtCW,GAA3B,MAIA,SAAAC,0BAAAN,GAKD,IAAKA,EAAK,IAALA,IAAAA,EAACE,OAAQ,IA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,EAElB3B,EAAGJ,MAAOkC,QAAS,UAEN,GAATC,EACJ,OAAO,KASX/B,EAAGrH,SAASC,MAAO2H,GAClB,QACA,6BACA,WAECP,EAAG,0BAA4BA,EAAGJ,MAAOlC,SAAS9B,KAAM,UAAa,kBAAmB0B,IAAK,UAAW,SACxG0C,EAAG,0BAA4BA,EAAGJ,MAAOlC,SAAS9B,KAAM,UAAa,sBAAuB0B,IAAK,UAAW,QAC5G0C,EAAGJ,MAAOlC,SAASA,SAASI,SAAU,WAAYzD,YAAa,UAC/D2F,EAAGJ,MAAOlC,SAASvC,SAAU,UAC7BE,oBAAqB2E,EAAGJ,MAAOlC,SAAS9B,KAAM,aAIhDoE,EAAGrH,SAASC,MAAO2H,GAClB,QACA,iCACA,WACCP,EAAG,0BAA4BA,EAAGJ,MAAOlC,SAAS9B,KAAM,UAAa,kBAAmB0B,IAAK,UAAW,QACxG0C,EAAG,0BAA4BA,EAAGJ,MAAOlC,SAAS9B,KAAM,UAAa,sBAAuB0B,IAAK,UAAW,SAC5G0C,EAAGJ,MAAOlC,SAASA,SAASI,SAAU,WAAYzD,YAAa,UAC/D2F,EAAGJ,MAAOlC,SAASvC,SAAU,UAC7BE,oBAAqB2E,EAAGJ,MAAOlC,SAAS9B,KAAM,aAOhDoE,EAAGrH,SAASC,MAAO2H,GAClB,QACA,oBACA,WACCP,EAAG,OAASA,EAAGJ,MAAOhE,KAAM,UAAa,aAAc+B,aAM3D,IAAIgE,iBAAkB","file":"admin.min.js","sourcesContent":["/**\n * The JS file for the repeater field\n *\n * @package panda_pods_repeater_field\n * @author Dongjie Xu\n */\n\n/**\n * Collection for JS functions\n *\n * @package panda_pods_repeater_field\n * @author Dongjie Xu\n * @since 09/02/2016\n */\nfunction pprf_resize_iframe(obj) {\n\tobj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';\n\n}\n\nfunction pprf_update_iframe_size( x, y ){\n\n\tif ( x != '' ) {\n\t\tjQuery( '#' + x ).height( jQuery( '#' + x ).height() ).animate( {height: y}, 500 );\n\t}\n}\nfunction pprf_update_size( x ){\n\n\tif ( x != '' ) {\n\t\tvar pprf_original_height = jQuery( x + ' html #wpbody-content' ).height() + 60;\n\n\t\tjQuery( '#' + x ).height( jQuery( '#' + x ).height() ).animate( {height: pprf_original_height }, 500 );;\n\n\t}\n}\n\nfunction pprf_update_parent_iframe( x ){\n\n\tif ( x != '') {\n\n\t\tvar y = jQuery( '#' + x + ' html #wpbody-content' ).height();\n\t\t// 4px is the small gap at the bottom\n\t\tjQuery( '#' + x ).height( jQuery( '#' + x ).height() ).animate( {height: y }, 500 );\n\n\t}\n}\nvar pprf_parent_height = jQuery( 'html' ).height();\n/**\n * Insert a new row to the page after adding a new item.\n */\nfunction pprf_new( podid, postid, cpodid, authorid , iframeid, poditemid, parent_name ){\n\n\tif ( false === isNaN( podid ) && false === isNaN( cpodid ) && false === isNaN( authorid ) && false === isNaN( poditemid ) ) {\n\n\t\tvar para_obj = { 'podid': podid, 'postid': postid, 'cpodid': cpodid, 'authorid': authorid, 'poditemid' : poditemid, 'action' : 'admin_pprf_load_newly_added', 'security' : ajax_script.nonce };\n\n\t\tvar data_obj = para_obj;\n\n\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-loader' ).removeClass( 'hidden' );\n\t\tjQuery.post(\n\t\t\tajax_script.ajaxurl,\n\t\t\tdata_obj,\n\t\t\tfunction( responses ){\n\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-loader' ).addClass( 'hidden' );\n\n\t\t\t\tvar response_data = responses['data'];\n\n\t\t\t\tif ( responses['success'] === true && typeof response_data['id'] !== 'undefined' && false === isNaN( response_data['id'] ) ) {\n\n\t\t\t\t\tvar\tiframe_build = pprf_build_item_html( response_data, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name, false );\n\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list' ).append( iframe_build );\n\t\t\t\t\t// If entries limit, toggle the add new.\n\t\t\t\t\tvar items_left_count = jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li' ).length;\n\t\t\t\t\tvar limit_int = parseInt( jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-entry-limit' ).val() );\n\t\t\t\t\tif ( limit_int != 0 && items_left_count >= limit_int ) {\n\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new' ).addClass( 'hidden' );\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t// If add a new one, activeate the live items tab.\n\t\t\t\tjQuery( '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab .dashicons-portfolio' ).click();\n\n\t\t\t\tpprf_odd_even_color( cpodid + '-' + poditemid );\n\t\t\t}\n\t\t);\n\t}\n}\n\nfunction pprf_build_item_html( items, podid, postid, cpodid, authorid , iframeid, poditemid, parent_name, is_repeated ){\n\tif ( typeof items['id'] == 'undefined' || true === isNaN( items['id'] ) || true === isNaN( podid ) ) {\n\t\treturn '';\n\t}\n\tvar trashed_css\t\t= '';\n\tvar btn_trashed_css\t= 'pprf-btn-delete';\n\tvar display_style\t= '';\n\tvar edit_icon_css\t= 'dashicons-edit';\n\n\tif ( jQuery( '#panda-repeater-trash-info-' + cpodid + '-' + poditemid ).data( 'enable-trash' ) == 1 ) {\n\t\tif ( typeof items['trashed'] != 'undefined' && items['trashed'] == 1 ) {\n\n\t\t\ttrashed_css \t= 'pprf-trashed';\n\t\t\tbtn_trashed_css\t= 'pprf-btn-trashed';\n\t\t\t// If the portfolio foder is open, hide the trash one.\n\t\t\tedit_icon_css = 'dashicons-update ';\n\t\t\tif ( jQuery( '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab.active .dashicons' ).hasClass( 'dashicons-portfolio' ) ) {\n\t\t\t\tdisplay_style = 'display:none;';\n\t\t\t}\n\n\t\t} else {\n\t\t\ttrashed_css\t\t= 'pprf-not-trashed';\n\t\t\tbtn_trashed_css\t= 'pprf-btn-not-trashed';\n\t\t\tif ( jQuery( '#panda-repeater-fields-tabs-' + cpodid + '-' + poditemid + ' .pprf-tab.active .dashicons' ).hasClass( 'dashicons-trash' ) ) {\n\t\t\t\tdisplay_style = 'display:none;';\n\t\t\t}\n\t\t}\n\t}\n\tvar repeated_css_append\t= '';\n\tif ( is_repeated == true ) {\n\t\trepeated_css_append\t= '-repeated';\n\t}\n\tvar delete_action = '';\n\tvar ids_in_css = cpodid + '-' + items['id'] + '-' + poditemid;\n\tvar responding_id = items['id'];\n\tvar the_title = items['title'];\n\tvar the_label = the_title;\n\n\tif ( typeof items['label'] != 'undefined' && items['label'] != '' ) {\n\t\tthe_label = items['label'];\n\t}\n\tvar next_background_css\t= jQuery( '#next-bg' ).data( 'bg' );\n\tvar full_url\t \t\t= PANDA_PODS_REPEATER_PAGE_URL[0] + 'iframe_id=panda-repeater-edit-' + ids_in_css + '&podid=' + podid + '&tb=' + cpodid + '&postid=' + postid + '&itemid=' + responding_id + '&poditemid=' + poditemid + '&pprf_nonce=' + PANDA_PODS_REPEATER_CONSTANTS.nonce;\n\tvar html_build \t\t=\n\t'<li data-id=\"' + responding_id + '\" class=\"' + trashed_css + '\" id=\"li-' + ids_in_css + repeated_css_append + '\" style=\"' + display_style + '\">' +\n\t\t'<div class=\"pprf-row w100 pprf-left\">' +\n\t\t\t'<div class=\"w100 pprf-left\" id=\"pprf-row-brief-' + ids_in_css + repeated_css_append + '\">' +\n\t\t\t\t'<div class=\"pprf-left pd8 pprf-left-col ' + next_background_css + ' \">' + the_label + '</div>';\n\n\tif ( is_repeated == true ) {\n\t\thtml_build +=\n\t\t'<div class=\"button pprf-right-col center pprf-dismiss-btn ' + delete_action + ' ' + btn_trashed_css + '\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' +\n\t\t\t'<span class=\"dashicons dashicons-dismiss pdt6 mgb0 \"></span>' +\n\t\t'</div>' +\n\t\t'<div class=\"pprf-left pd8\">Repeated</div>';\n\t} else {\n\t\thtml_build +=\n\t\t'<div class=\"button pprf-right-col center pprf-trash-btn ' + delete_action + ' ' + btn_trashed_css + '\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' +\n\t\t\t'<span class=\"dashicons dashicons-trash pdt6 mgb0 \"></span>' +\n\t\t\t'<div id=\"panda-repeater-trash-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\n\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_CONSTANTS.url + '/images/dots-loading.gif\" alt=\"loading\" class=\"mgl8 loading pprf-left\"/>' +\n\t\t\t'</div>' +\n\t\t'</div>' +\n\t\t'<div class=\"button pprf-right-col center pprf-save-btn\" role=\"button\" data-podid=\"' + podid + '\" data-postid=\"' + postid + '\" data-tb=\"' + cpodid + '\" data-itemid=\"' + responding_id + '\" data-userid=\"' + authorid + '\" data-iframe_id=\"panda-repeater-edit-' + ids_in_css + '\" data-poditemid=\"' + poditemid + '\" data-target=\"' + ids_in_css + '\" >' +\n\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_CONSTANTS.url + 'images/save-icon-tran.png\" class=\"pprf-save-icon mgt8 mgb2\"/>' +\n\t\t\t'<div id=\"panda-repeater-save-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\n\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_CONSTANTS.url + 'images/dots-loading.gif\" alt=\"loading\" class=\"mgl8 pprf-left\"/>' +\n\t\t\t'</div>' +\n\t\t'</div>' +\n\t\t'<div class=\"button pprf-edit pprf-row-load-iframe alignright pprf-right-col center pprf-edit-btn\" role=\"button\" data-target=\"' + ids_in_css + '\" data-url=\"' + full_url + '\">' +\n\t\t\t'<span class=\"dashicons ' + edit_icon_css + ' pdt8 mgb0 pprf-edit-span\"></span>' +\n\t\t\t'<div id=\"panda-repeater-edit-' + ids_in_css + '-loader\" class=\"pprf-left hidden mgl5\">' +\n\t\t\t\t'<img src = \"' + PANDA_PODS_REPEATER_CONSTANTS.url + '/images/dots-loading.gif\" alt=\"loading\" class=\"mgl9 pprf-left\"/>' +\n\t\t\t'</div>\t' +\n\t\t'</div>';\n\t}\n\thtml_build +=\n\t\t'</div>' +\n\t\t'<div>' +\n\t\t\t'<iframe id=\"panda-repeater-edit-' + ids_in_css + '\" frameborder=\"0\" scrolling=\"no\" src=\"\" style=\"display:none; \" class=\"panda-repeater-iframe w100\"></iframe>' +\n\t\t\t'<div id=\"panda-repeater-edit-expand-' + ids_in_css + '\" class=\"w100 pprf-left center pdt3 pdb3 pprf-expand-bar pprf-edit-expand\" data-target=\"' + ids_in_css + '\" style=\"display:none;\">Content missing? Click here to expand</div>' +\n\t\t'</div>' +\n\t\t'</div>' +\n\t'</li>';\n\tif ( next_background_css === 'pprf-purple-bg' ) {\n\t\tjQuery( '#next-bg' ).data( 'bg', 'pprf-white-bg' );\n\t} else {\n\t\tjQuery( '#next-bg' ).data( 'bg', 'pprf-purple-bg' );\n\t}\n\treturn html_build;\n}\n/**\n * Delete an item\n */\nfunction pprf_delete_item( podid, postid, cpodid, itemid, authorid , iframeid, poditemid, trashed ){\n\n\tif ( false === isNaN( podid ) && false === isNaN( cpodid ) && false === isNaN( authorid ) && false === isNaN( itemid ) && false === isNaN( poditemid ) ) {\n\n\t\tvar para_obj = { 'podid': podid, 'postid': postid, 'cpodid': cpodid, 'itemid' : itemid, 'authorid': authorid, 'poditemid' : poditemid, 'action' : 'admin_pprf_delete_item', 'trash' : trashed, 'security' : ajax_script.nonce };\n\t\tvar info_text = '';\n\t\tif ( trashed == 0 ) {\n\t\t\tinfo_text = strs_obj.be_restored;\n\t\t}\n\t\tif ( trashed == 1 ) {\n\t\t\tinfo_text = strs_obj.can_recover;\n\t\t}\n\t\tif ( trashed == 2 ) {\n\t\t\tinfo_text = strs_obj.be_deleted;\n\t\t}\n\n\t\tvar data_obj = para_obj;\n\t\tvar passed = confirm( strs_obj.you_sure + ' ' + info_text );\n\n\t\tif ( passed === true ) {\n\n\t\t\tif ( trashed == 0 ) {\n\t\t\t\tjQuery( '#panda-repeater-edit-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).removeClass( 'hidden' );\n\t\t\t} else {\n\t\t\t\tjQuery( '#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).removeClass( 'hidden' );\n\t\t\t}\n\n\t\t\tjQuery.post(\n\t\t\t\tajax_script.ajaxurl,\n\t\t\t\tdata_obj,\n\t\t\t\tfunction( responses ){\n\t\t\t\t\tif ( responses['success'] === true ) {\n\t\t\t\t\t\tvar response_data = responses['data'];\n\t\t\t\t\t\tif ( response_data.length != 0 ) {\n\t\t\t\t\t\t\tvar ids_in_css = cpodid + '-' + itemid + '-' + poditemid;\n\t\t\t\t\t\t\tvar exp_str = 'panda-repeater-edit-expand-' + ids_in_css;\n\t\t\t\t\t\t\tvar iframe_build = 'panda-repeater-edit-' + ids_in_css;\n\n\t\t\t\t\t\t\tif ( trashed == 0 ) {\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-edit-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).addClass( 'hidden' );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-trash-' + cpodid + '-' + itemid + '-' + poditemid + '-loader' ).addClass( 'hidden' );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( trashed == 0 ) {\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).removeClass( 'dashicons-update' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).addClass( 'dashicons-edit' )\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).removeClass( 'pprf-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).addClass( 'pprf-not-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).css( 'display', 'none' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn' ).addClass( 'pprf-btn-not-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn' ).removeClass( 'pprf-btn-trashed' );\n\n\t\t\t\t\t\t\t\tif ( jQuery.trim( jQuery( '#' + iframe_build ).contents().find( \"body\" ).html() ) != '' ) {\n\t\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-save-btn .pprf-save-icon' ).attr( 'src', PANDA_PODS_REPEATER_CONSTANTS.url + 'images/save-icon.png' );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( trashed == 1 ) {\n\n\t\t\t\t\t\t\t\tif ( jQuery( '#' + iframe_build ) != 'undefined' ) {\n\t\t\t\t\t\t\t\t\tjQuery( '#' + iframe_build ).hide();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( jQuery( '#' + exp_str ) != 'undefined' ) {\n\t\t\t\t\t\t\t\t\tjQuery( '#' + exp_str ).hide();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tjQuery( '#pprf-row-brief-' + ids_in_css + ' .dashicons' ).removeClass( 'dashicons-arrow-up' );\n\t\t\t\t\t\t\t\tjQuery( '#pprf-row-brief-' + ids_in_css + ' .dashicons' ).addClass( 'dashicons-edit' );\n\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).removeClass( 'pprf-not-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).addClass( 'pprf-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).css( 'display', 'none' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).addClass( 'dashicons-update' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-row-load-iframe .pprf-edit-span' ).removeClass( 'dashicons-edit' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn' ).addClass( 'pprf-btn-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-trash-btn' ).removeClass( 'pprf-btn-not-trashed' );\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"] .pprf-save-btn .pprf-save-icon' ).attr( 'src', PANDA_PODS_REPEATER_CONSTANTS.url + 'images/save-icon-tran.png' );\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( trashed == 2 ) {\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' #' + iframeid ).parent().parent().remove();\n\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).remove();\n\t\t\t\t\t\t\t\t// If entries limit, toggle the add new.\n\t\t\t\t\t\t\t\tvar items_left_count = jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' > .pprf-redorder-list > li' ).length;\n\t\t\t\t\t\t\t\tvar limit_int = parseInt( jQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-entry-limit' ).val() );\n\t\t\t\t\t\t\t\tif ( limit_int != 0 && items_left_count < limit_int ) {\n\t\t\t\t\t\t\t\t\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + '-add-new' ).removeClass( 'hidden' );\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Integrate with simpods js.\n\t\t\t\t\t\t\t\tif ( typeof call_simpods !== 'undefined' && jQuery.isFunction( call_simpods ) ) {\n\t\t\t\t\t\t\t\t\tcall_simpods( responses );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tpprf_odd_even_color( cpodid + '-' + poditemid );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\n\t\t}\n\t}\n}\n\njQuery( document ).on(\n\t'click',\n\t'.pprf-redorder-btn',\n\tfunction( evt ){\n\t\tvar id = jQuery( this ).data( 'id' );\n\t\tjQuery( this ).addClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-save-redorder-btn' ).removeClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-redorder-list-wrap' ).removeClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-row' ).addClass( 'hidden' );\n\t\tjQuery( '#' + id + '-add-new' ).addClass( 'hidden' );\n\t}\n);\n\n\njQuery( document ).on(\n\t'click',\n\t'.pprf-save-redorder-btn',\n\tfunction( evt ){\n\t\tvar id = jQuery( this ).data( 'id' );\n\t\tjQuery( this ).addClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-redorder-list-wrap' ).addClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-save-redorder-btn' ).addClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-redorder-btn' ).removeClass( 'hidden' );\n\t\tjQuery( this ).parent().children( '.pprf-row' ).removeClass( 'hidden' );\n\t\tjQuery( '#' + id + '-add-new' ).removeClass( 'hidden' );\n\t}\n);\n/**\n * Load more.\n */\njQuery( document ).on(\n\t'click',\n\t'.pprf-load-more-btn',\n\tfunction( evt ){\n\t\tevt.preventDefault();\n\t\tjQuery( '#pprf-load-more-wrap-' + jQuery( this ).data( 'target' ) + ' .pprf-ajax-img' ).css( 'display', 'block' );\n\n\t\tpprf_load_more( jQuery( this ).data( 'target' ), jQuery( this ) );\n\n\t}\n)\n\nfunction pprf_load_more( target_str, ele_obj ){\n\tvar loaded_arr = new Array();\n\tjQuery( '#panda-repeater-fields-' + target_str + ' .pprf-redorder-list li' ).each(\n\t\tfunction( idx_int ) {\n\t\t\tloaded_arr[ idx_int ] = parseInt( jQuery( this ).data( 'id' ) );\n\t\t}\n\t);\n\n\tvar data_obj = {\n\t\taction \t\t: \t'admin_pprf_load_more',\n\t\tloaded \t\t:\tloaded_arr,\n\t\tsecurity \t: \tajax_script.nonce,\n\t\tpod_id\t\t: \tele_obj.data( 'podid' ),\n\t\tpost_id\t\t: \tele_obj.data( 'postid' ),\n\t\tsaved_tb\t: \tele_obj.data( 'tb' ),\n\t\tiframe_id \t: \tele_obj.data( 'iframe_id' ),\n\t\tpod_item_id\t: \tele_obj.data( 'poditemid' ),\n\t\tauthorid\t: \tele_obj.data( 'userid' ),\n\t\tcp_title\t: \tele_obj.data( 'cptitle' ),\n\t\ttrashable\t: \tele_obj.data( 'enable-trash' ),\n\t\torder\t\t: \tele_obj.data( 'order' ),\n\t\torder_by\t: \tele_obj.data( 'order-by' ),\n\t\tamount\t\t: \tjQuery( '#panda-repeater-amount-' + target_str ).val(),\n\t\tstart\t\t: \tjQuery( '#panda-repeater-start-from-' + target_str ).val()\n\t};\n\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-load-more-report' ).text( '' );\n\tjQuery.post(\n\t\tajax_script.ajaxurl,\n\t\tdata_obj,\n\t\tfunction( response_obj ){\n\t\t\tvar html_build = '';\n\t\t\tif ( response_obj.success == true ) {\n\t\t\t\tvar trashed_count = 0;\n\t\t\t\tvar data_length = response_obj.data.length;\n\t\t\t\tvar loaded_length = loaded_arr.length;\n\t\t\t\tfor ( var i = 0; i < data_length; i ++ ) {\n\t\t\t\t\tvar is_repeated\t= false;\n\n\t\t\t\t\tif ( jQuery( '#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load' ).val() === 'append_to' ) { // Only need to check repeatition if it is on Append To.\n\t\t\t\t\t\tfor ( var j = 0; j < loaded_length; j ++ ) {\t// InArry doesn't work.\n\t\t\t\t\t\t\tif ( parseInt( response_obj.data[ i ]['id'] ) == loaded_arr[ j ] ) {\n\t\t\t\t\t\t\t\tis_repeated\t= true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\thtml_build += pprf_build_item_html( response_obj.data[ i ], data_obj.pod_id, data_obj.post_id, data_obj.saved_tb, data_obj.authorid , data_obj.iframe_id, data_obj.pod_item_id, data_obj.cp_title, is_repeated )\n\t\t\t\t\tif ( response_obj.data[ i ]['trashed'] == 1 ) {\n\t\t\t\t\t\ttrashed_count ++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar info_text = response_obj.data.length;\n\t\t\t\tif ( data_obj.trashable == 1 ) {\n\t\t\t\t\tinfo_text = ( parseInt( response_obj.data.length ) - trashed_count ) + ' published, ' + trashed_count + ' trashed.';\n\t\t\t\t}\n\t\t\t\tif ( jQuery( '#pprf-load-more-wrap-' + target_str + ' .panda-repeater-to-load' ).val() == 'append_to' ) {\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + data_obj.saved_tb + '-' + data_obj.pod_item_id + ' .pprf-redorder-list' ).append( html_build );\n\t\t\t\t} else {\n\t\t\t\t\tjQuery( '#panda-repeater-fields-' + data_obj.saved_tb + '-' + data_obj.pod_item_id + ' .pprf-redorder-list' ).html( html_build );\n\t\t\t\t}\n\t\t\t\tpprf_odd_even_color( data_obj.saved_tb + '-' + data_obj.pod_item_id );\n\t\t\t\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-ajax-img' ).css( 'display', 'none' );\n\n\t\t\t\tif ( response_obj.data.length != 0 ) {\n\t\t\t\t\tjQuery( '#panda-repeater-start-from-' + target_str ).val( parseInt( data_obj.start ) + parseInt( response_obj.data.length ) );\n\t\t\t\t}\n\n\t\t\t\tjQuery( '#pprf-load-more-wrap-' + target_str + ' .pprf-load-more-report' ).text( ' | Loaded ' + info_text );\n\t\t\t}\n\n\t\t}\n\t);\n}\n/**\n * Reset colours for each row.\n */\nfunction pprf_odd_even_color( ids ){\n\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col' ).removeClass( 'pprf-purple-bg' );\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col' ).removeClass( 'pprf-white-bg' );\n\n\tif ( jQuery( '#panda-repeater-fields-tabs-' + ids ).length == 0 ) {\n\n\t\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-left-col' ).each(\n\t\t\tfunction( idx ) {\n\t\t\t\tif ( idx % 2 == 0 ) {\n\t\t\t\t\tjQuery( this ).addClass( 'pprf-white-bg' );\n\t\t\t\t} else {\n\t\t\t\t\tjQuery( this ).addClass( 'pprf-purple-bg' );\n\t\t\t\t}\n\t\t\t}\n\t\t)\n\t}\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-not-trashed' ).each(\n\t\tfunction( idx ) {\n\t\t\tif ( idx % 2 == 0 ) {\n\t\t\t\tjQuery( this ).children( '.pprf-row' ).children().children( '.pprf-left-col' ).addClass( 'pprf-white-bg' );\n\t\t\t} else {\n\t\t\t\tjQuery( this ).children( '.pprf-row' ).children().children( '.pprf-left-col' ).addClass( 'pprf-purple-bg' );\n\t\t\t}\n\t\t}\n\t);\n\tjQuery( '#panda-repeater-fields-' + ids + ' .pprf-trashed' ).each(\n\t\tfunction( idx ) {\n\t\t\tif ( idx % 2 == 0 ) {\n\t\t\t\tjQuery( this ).children( '.pprf-row' ).children().children( '.pprf-left-col' ).addClass( 'pprf-white-bg' );\n\t\t\t} else {\n\t\t\t\tjQuery( this ).children( '.pprf-row' ).children().children( '.pprf-left-col' ).addClass( 'pprf-purple-bg' );\n\t\t\t}\n\t\t}\n\t);\n}\n/**\n * If reassigned successfully, remove the item and reset colours.\n */\nfunction pprf_reassign( cpodid, poditemid, itemid ){\n\n\tjQuery( '#panda-repeater-fields-' + cpodid + '-' + poditemid + ' .pprf-redorder-list li[data-id=\"' + itemid + '\"]' ).remove();\n\n\tpprf_odd_even_color( cpodid + '-' + poditemid );\n}\njQuery( document ).ready(\n\tfunction($) {\n\t\t/**\n\t\t * Fix_helper_modified for drag and drop.\n\t\t */\n\t\tvar fix_helper_modified = function(e, tr) {\n\t\t\t\tvar $originals = tr.children();\n\t\t\t\tvar $helper = tr.clone();\n\t\t\t$helper.children().each(\n\t\t\t\tfunction(index) {\n\t\t\t\t\t$( this ).width( $originals.eq( index ).width() );\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn $helper;\n\t\t},\n\t\tupdate_index = function(e, ui) {\n\t\t\t\tvar the_order = $( this ).sortable( 'toArray' );\n\n\t\t\t\tvar data_obj = {\n\t\t\t\t\taction: 'admin_pprf_update_order',\n\t\t\t\t\torder: \t the_order,\n\t\t\t\t\tsecurity : ajax_script.nonce\n\t\t\t};\n\n\t\t\t$.post(\n\t\t\t\tajax_script.ajaxurl,\n\t\t\t\tdata_obj,\n\t\t\t\tfunction( resp_arr ){\n\t\t\t\t\tpprf_odd_even_color( resp_arr.data.pprf_id );\n\t\t\t\t}\n\t\t\t)\n\t\t};\n\n\t\tif ( $( '.pprf-redorder-list.pandarf_order' ).length != 0 ) {\n\t\t\t$( '.pprf-redorder-list.pandarf_order' ).sortable(\n\t\t\t\t{\n\t\t\t\t\thelper: fix_helper_modified,\n\t\t\t\t\tcursor: 'move',\n\t\t\t\t\topacity: 0.7,\n\t\t\t\t\ttolerance: 'intersect',\n\t\t\t\t\tupdate: \t\tupdate_index,\n\t\t\t\t\tcancel: \t\t'.pprf-row-load-iframe, .pprf-save-btn, pprf-trash-btn',\n\t\t\t\t\thandle: \t\t'.pprf-left-col'\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-row-load-iframe',\n\t\t\tfunction( e ){\n\t\t\t\te.stopPropagation();\n\t\t\t\tvar url_str = $( this ).data( 'url' );\n\t\t\t\tvar ids_in_css = $( this ).data( 'target' );\n\t\t\t\tvar exp_str = 'panda-repeater-edit-expand-' + ids_in_css;\n\t\t\t\tvar iframe_build = 'panda-repeater-edit-' + ids_in_css;\n\t\t\t\tvar trash_ele = $( this ).parent().children( '.pprf-trash-btn' );\n\t\t\t\tif ( $( this ).children( '.pprf-edit-span' ).hasClass( 'dashicons-update' ) ) {\n\t\t\t\t\t// Restore this item.\n\t\t\t\t\tpprf_delete_item( trash_ele.data( 'podid' ), trash_ele.data( 'postid' ), trash_ele.data( 'tb' ), trash_ele.data( 'itemid' ), trash_ele.data( 'userid' ), trash_ele.data( 'iframe_id' ), trash_ele.data( 'poditemid' ), 0 );\n\t\t\t\t} else {\n\t\t\t\t\t\tvar addEdit_str = ' .pprf-edit';\n\t\t\t\t\tif ( $( this ).hasClass( 'pprf-add' ) ) {\n\t\t\t\t\t\taddEdit_str = '.pprf-add';\n\t\t\t\t\t\tiframe_build = 'panda-repeater-add-new-' + ids_in_css;\n\t\t\t\t\t\texp_str = 'panda-repeater-add-new-expand-' + ids_in_css;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( $( '#pprf-row-brief-' + ids_in_css + ' .dashicons' ).hasClass( 'dashicons-edit' ) ) {\n\n\t\t\t\t\t\t// If iframe not loaded.\n\n\t\t\t\t\t\tif ( $( '#' + iframe_build ).attr( 'src' ) == '' ) {\n\t\t\t\t\t\t\t$( '#' + iframe_build ).attr( 'src', url_str );\n\t\t\t\t\t\t\t$( '#' + iframe_build + '-loader' ).removeClass( 'hidden' );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$( '#' + iframe_build ).show(\n\t\t\t\t\t\t\t'slow',\n\t\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).addClass( 'dashicons-arrow-up' );\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + '' + addEdit_str + ' .dashicons' ).removeClass( 'dashicons-edit' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$( '#' + exp_str ).show();\n\t\t\t\t\t\t$( '#' + iframe_build ).on(\n\t\t\t\t\t\t\t'load',\n\t\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\t\t$( '#' + iframe_build + '-loader' ).addClass( 'hidden' );\n\t\t\t\t\t\t\t\t// Change icon.\n\t\t\t\t\t\t\t\t$( '#panda-repeater-save-' + ids_in_css + '-loader' ).parent().children( '.pprf-save-icon' ).attr( 'src', PANDA_PODS_REPEATER_CONSTANTS.url + '/images/save-icon.png' );\n\t\t\t\t\t\t\t\t$( '#panda-repeater-save-' + ids_in_css + '-loader' ).parent().addClass( 'pprf-btn-ready' );\n\t\t\t\t\t\t\t\t$( '#panda-repeater-save-' + ids_in_css + '-loader' ).addClass( 'hidden' );\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons' ).addClass( 'dashicons-arrow-up' );\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons' ).removeClass( 'dashicons-edit' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t$( '#' + iframe_build ).hide(\n\t\t\t\t\t\t\t'slow',\n\t\t\t\t\t\t\tfunction(){\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons' ).removeClass( 'dashicons-arrow-up' );\n\t\t\t\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + addEdit_str + ' .dashicons' ).addClass( 'dashicons-edit' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$( '#' + exp_str ).hide();\n\n\t\t\t\t\t}\n\t\t\t\t\t$( '#pprf-row-brief-' + ids_in_css + ' .dashicons-trash' ).removeClass( 'dashicons-arrow-up' );\n\t\t\t\t}\n\n\t\t\t}\n\t\t);\n\t\t/**\n\t\t * Click to explan its iframe.\n\t\t */\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-expand-bar',\n\t\t\tfunction(){\n\t\t\t\tvar ids = $( this ).data( 'target' );\n\t\t\t\tvar iframe = 'panda-repeater-edit-' + ids;\n\t\t\t\tif ( $( this ).hasClass( 'pprf-add-expand' ) ) {\n\t\t\t\t\tiframe = 'panda-repeater-add-new-' + ids;\n\t\t\t\t}\n\t\t\t\tif ( typeof document.getElementById( iframe ) != 'undefined' ) {\n\t\t\t\t\tif ( typeof document.getElementById( iframe ).contentWindow.pprf_resize_window != 'undefined' ) {\n\t\t\t\t\t\tdocument.getElementById( iframe ).contentWindow.pprf_resize_window();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t/**\n\t\t * Click to delete.\n\t\t */\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-trash-btn',\n\t\t\tfunction( e ){\n\t\t\t\te.stopPropagation();\n\t\t\t\tvar ids = $( this ).data( 'target' );\n\t\t\t\tvar iframe = 'panda-repeater-edit-' + ids;\n\t\t\t\tif ( $( this ).hasClass( 'pprf-add-expand' ) ) {\n\t\t\t\t\tiframe = 'panda-repeater-add-new-' + ids;\n\t\t\t\t}\n\t\t\t\tvar trash = 0;\n\t\t\t\tif ( $( this ).hasClass( 'pprf-btn-not-trashed' ) ) {\n\t\t\t\t\ttrash = 1;\n\t\t\t\t}\n\t\t\t\tif ( $( this ).hasClass( 'pprf-btn-trashed' ) ) {\n\t\t\t\t\ttrash = 2;\n\t\t\t\t}\n\t\t\t\tif ( $( this ).hasClass( 'pprf-btn-delete' ) ) {\n\t\t\t\t\ttrash = 2;\n\t\t\t\t}\n\t\t\t\tpprf_delete_item( $( this ).data( 'podid' ), $( this ).data( 'postid' ), $( this ).data( 'tb' ), $( this ).data( 'itemid' ), $( this ).data( 'userid' ), $( this ).data( 'iframe_id' ), $( this ).data( 'poditemid' ), trash );\n\t\t\t}\n\t\t)\n\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-save-btn',\n\t\t\tfunction( e ){\n\t\t\t\te.stopPropagation();\n\t\t\t\tif ( $( this ).hasClass( 'pprf-btn-ready' ) ) {\n\t\t\t\t\tvar ids = $( this ).data( 'target' );\n\t\t\t\t\tvar iframe = 'panda-repeater-edit-' + ids;\n\t\t\t\t\tif ( $( this ).hasClass( 'pprf-save-new-btn' ) ) {\n\t\t\t\t\t\tiframe = 'panda-repeater-add-new-' + ids;\n\t\t\t\t\t}\n\t\t\t\t\t$( '#panda-repeater-save-' + ids + '-loader' ).removeClass( 'hidden' );\n\n\t\t\t\t\t$( '#' + iframe ).contents().find( '.pods-submit-button' ).trigger( \"click\" );\n\t\t\t\t\tpprf_is_changed = false;\n\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t/**\n\t\t * If a pods is is clicked, flag it as saved.\n\t\t */\n\t\t$( '.toplevel_page_panda-pods-repeater-field .pods-field-input' ).on(\n\t\t\t'click keyup change',\n\t\t\tfunction(){\n\t\t\t\tpprf_is_changed = true;\n\t\t\t}\n\t\t);\n\n\t\t$( document ).on(\n\t\t\t'click',\n\t\t\t'#publishing-action .button, #save-action .button',\n\t\t\tfunction(){\n\t\t\t\tif ( pprf_is_changed ) {\n\t\t\t\t\t\tevt.preventDefault();\n\t\t\t\t\t\tvar leave = confirm( strs_obj.Ignore_changes );\n\t\t\t\t\tif ( leave == true) {\n\t\t\t\t\t\tpprf_is_changed = false;\n\n\t\t\t\t\t\t$( this ).trigger( 'click' );\n\t\t\t\t\t}\n\t\t\t\t\tif ( leave == false) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\t/**\n\t\t * Toggle trashed and current.\n\t\t */\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-tab .dashicons-trash',\n\t\t\tfunction(){\n\n\t\t\t\t$( '#panda-repeater-fields-' + $( this ).parent().data( 'target' ) + ' .pprf-trashed' ).css( 'display', 'block' );\n\t\t\t\t$( '#panda-repeater-fields-' + $( this ).parent().data( 'target' ) + ' .pprf-not-trashed' ).css( 'display', 'none' );\n\t\t\t\t$( this ).parent().parent().children( '.active' ).removeClass( 'active' );\n\t\t\t\t$( this ).parent().addClass( 'active' );\n\t\t\t\tpprf_odd_even_color( $( this ).parent().data( 'target' ) );\n\n\t\t\t}\n\t\t)\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-tab .dashicons-portfolio',\n\t\t\tfunction(){\n\t\t\t\t$( '#panda-repeater-fields-' + $( this ).parent().data( 'target' ) + ' .pprf-trashed' ).css( 'display', 'none' );\n\t\t\t\t$( '#panda-repeater-fields-' + $( this ).parent().data( 'target' ) + ' .pprf-not-trashed' ).css( 'display', 'block' );\n\t\t\t\t$( this ).parent().parent().children( '.active' ).removeClass( 'active' );\n\t\t\t\t$( this ).parent().addClass( 'active' );\n\t\t\t\tpprf_odd_even_color( $( this ).parent().data( 'target' ) );\n\t\t\t}\n\t\t)\n\n\t\t/**\n\t\t * Remove repeated.\n\t\t */\n\t\t$( document.body ).on(\n\t\t\t'click',\n\t\t\t'.pprf-dismiss-btn',\n\t\t\tfunction(){\n\t\t\t\t$( '#li-' + $( this ).data( 'target' ) + '-repeated' ).remove();\n\t\t\t}\n\t\t)\n\t}\n);\n\nvar pprf_is_changed\t= false;\n"]} -
panda-pods-repeater-field/trunk/panda-pods-repeater-field.php
r2829601 r2837947 1 1 <?php 2 /* 3 Plugin Name: Panda Pods Repeater Field 4 Plugin URI: https://wordpress.org/plugins/panda-pods-repeater-field/ 5 Description: Panda Pods Repeater Field is a plugin for Pods Framework. The beauty of it is that it is not just a repeater field. It is a quick way to set up a relational database and present the data on the same page. It takes the advantage of Pods table storage, so you don’t need to worry that the posts and postmeta data table may expand dramatically and slow down the page loading. This plugin is compatible with Pods Framework 2.6.1 or later. To download Pods Framework, please visit http://pods.io/. After each update, please clear the cache to make sure the CSS and JS are updated. Usually, Ctrl + F5 will do the trick. 6 Version: 1.5.4 7 Author: Dongjie Xu 8 Author URI: http://www.multimediapanda.co.uk/ 9 Text Domain: panda-pods-repeater-field 10 Domain Path: /languages 11 */ 12 13 14 // don't call the file directly 15 if ( !defined( 'ABSPATH' ) ) exit; 2 /** 3 * Panda Pods Repeater Field 4 * 5 * @package panda_pods_repeater_field 6 * @author Dongjie Xu 7 * @copyright Dongjie Xu 8 * @license GPL v2 or later 9 * 10 * Plugin Name: Panda Pods Repeater Field 11 * Plugin URI: https://wordpress.org/plugins/panda-pods-repeater-field/ 12 * Description: Panda Pods Repeater Field is a plugin for Pods Framework. The beauty of it is that it is not just a repeater field. It is a quick way to set up a relational database and present the data on the same page. It takes the advantage of Pods table storage, so you don’t need to worry that the posts and postmeta data table may expand dramatically and slow down the page loading. This plugin is compatible with Pods Framework 2.6.1 or later. To download Pods Framework, please visit http://pods.io/. After each update, please clear the cache to make sure the CSS and JS are updated. Usually, Ctrl + F5 will do the trick. 13 * Version: 1.5.5 14 * Author: Dongjie Xu 15 * Author URI: http://www.multimediapanda.co.uk/ 16 * Text Domain: panda-pods-repeater-field 17 * Domain Path: /languages 18 */ 19 20 /** 21 * The plugin initial file 22 */ 23 24 /** 25 * Don't call the file directly 26 */ 27 if ( ! defined( 'ABSPATH' ) ) { 28 exit; 29 } 16 30 /** 17 31 * Define constants … … 22 36 define( 'PANDA_PODS_REPEATER_URL', plugin_dir_url( __FILE__ ) ); 23 37 define( 'PANDA_PODS_REPEATER_DIR', plugin_dir_path( __FILE__ ) ); 24 define( 'PANDA_PODS_REPEATER_VERSION', '1.5.4' ); 25 // To emable deleting item descendants. Add it to the configure.php file. Only do it to if you have daily backup and backup before deleting an item. The plugin author is not responsible for any data loss 26 //define( 'PANDA_PODS_REPEATER_DELETE_ITEM_DESCENDANTS', true ); 27 28 29 /** 30 * Panda_Pods_Repeater_Field class 31 * 32 * @class Panda_Pods_Repeater_Field The class that holds the entire Panda_Pods_Repeater_Field plugin 33 * 34 * @since 1.0.0 35 */ 36 class Panda_Pods_Repeater_Field { 37 38 var $menu_title = 'Panda Pods Repeater Field'; 39 //public $can_elementor = false; 40 const TYPE_NAME = 'pandarepeaterfield'; 41 /** 42 * Constructor for the Panda_Pods_Repeater_Field class 43 * 44 * Sets up all the appropriate hooks and actions 45 * within the plugin. 46 * 47 * @since 1.0.0 48 */ 49 public function __construct() { 50 // Return false if Pods Framework is not available 51 if( ! class_exists('PodsField' ) ){ 52 return false; 53 } 54 $files = array( 55 'panda_pods_repeater_field_db', 56 'podsfield_pandarepeaterfield', 57 'panda_pods_repeater_field_ajax', 58 59 ); 60 61 $active_plugins = get_option('active_plugins'); 62 63 // if( in_array('elementor/elementor.php', $active_plugins ) && ! wp_doing_ajax() ){ 64 // $this->can_elementor = true; 65 // array_push( $files_arr, 'pprf_elementor_accordion_widget' ); 66 // } 67 68 $class_bln = true; 69 70 for( $i = 0; $i < count( $files ); $i ++ ){ 71 $file_str = dirname(__FILE__) . '/classes/' . $files[ $i ] . '.php'; 72 73 if( file_exists( $file_str ) ) { 74 $claName_str = str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $files[ $i ] ) ) ) ) ; 75 include_once $file_str; 76 77 if( !class_exists( $claName_str ) ) { 78 $class_bln = false; 79 } 80 } else { 81 $class_bln = false; 82 } 83 } 84 85 if( $class_bln ) { 86 // create an instance to store pods adavance custom tables 87 $panda_repeater_field = new podsfield_pandarepeaterfield(); 88 // ajax 89 $repeater_field_ajax = new Panda_Pods_Repeater_Field_Ajax(); 90 //add_action('admin_menu', array( $ssefProfile_cla, 'add_admin_menu_fn' ), 15); 91 92 foreach( PodsField_Pandarepeaterfield::$act_tables as $tb_str => $tbn_str ){ 93 // after pod saved 94 add_action('pods_api_post_save_pod_item_' . $tbn_str , array( $panda_repeater_field, 'pods_post_save' ), 10, 3); 95 add_action('pods_api_post_delete_pod_item_' . $tbn_str , array( $panda_repeater_field, 'pods_post_delete' ), 10, 3); 96 } 97 add_action( 'pods_admin_ui_setup_edit_fields', array( $panda_repeater_field, 'field_table_fields' ), 10, 2 ); 98 // check table fields when update pod editor 99 //add_action( 'save_post', array( $panda_repeater_field, 'update_child_pod' ), 10, 3 ); 100 101 } 102 //$this->instances(); 103 /** 104 * Plugin Setup 105 */ 106 register_activation_hook( __FILE__, array( $this, 'activate' ) ); 107 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); 108 109 // Localize our plugin, doesn't work 110 //add_action( 'init', array( $this, 'localization_setup' ) ); 111 112 /** 113 * Scripts/ Styles 114 */ 115 // Loads frontend scripts and styles 116 // 117 118 // Loads admin scripts and styles 119 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); 120 121 122 123 /** 124 * Hooks that extend Pods 125 * 126 * NOTE: These are some example hooks that are useful for extending Pods, uncomment as needed. 127 */ 128 129 //Example: Add a tab to the pods editor for a CPT Pod called 'jedi 130 //add_filter( 'pods_admin_setup_edit_tabs_post_type_jedi', array( $this, 'jedi_tabs' ), 11, 3 ); 131 132 //Example: Add fields to the Pods editor for all Advanced Content Types 133 //add_filter( 'pods_admin_setup_edit_options_advanced', array( $this, 'act_options' ), 11, 2 ); 134 //add_filter( 'pods_admin_setup_edit_options_advanced', array( $this, 'act_options' ), 11, 2 ); 135 // 136 //Example: Add a submenu item to Pods Admin Menu 137 add_filter( 'pods_admin_menu', array( $this, 'add_menu' ) ); 138 139 /** 140 //Complete Example: Add a tab for all post types and some options inside of it. 141 //See example callbacks below 142 add_filter( 'pods_admin_setup_edit_tabs_post_type', array( $this, 'pt_tab' ), 11, 3 ); 143 add_filter( 'pods_admin_setup_edit_options_post_type', array( $this, 'pt_options' ), 12, 2 ); 144 */ 145 //add_screen_option( 'per_page', array( 'default' => 0, 146 //'option' => 'pprf-auto-load' , 'label' => _x( 'Panda Pods Repeater Field auto load', 'panda-pods-repeater-fields' )) ); 147 // add filter to migrate package 148 149 // Elementor widget 150 // if( $this->can_elementor ){ 151 // add_action( 'elementor/widgets/widgets_registered', array( $this, 'register_widgets' ) ); 152 // } 153 154 155 } 156 157 /** 158 * Initializes the Panda_Pods_Repeater_Field() class 159 * 160 * Checks for an existing Panda_Pods_Repeater_Field() instance 161 * and if it doesn't find one, creates it. 162 * 163 * @since 1.0.0 164 */ 165 public static function init() { 166 static $prf_cla = false; 167 168 if ( ! $prf_cla ) { 169 $prf_cla = new Panda_Pods_Repeater_Field(); 170 171 // add to pod editor 172 //add_filter( 'pods_api_field_types', array( $prf_cla, 'filter_pods_api_field_types') ); 173 //add_filter( 'pods_form_field_include', array( $prf_cla, 'filter_pods_form_field_include'), 10, 2 ); 174 175 //add_filter( 'pods_form_ui_field_' . PodsField_Pandarepeaterfield::$type, array( $prf_cla, 'filter_pods_form_ui_field_panda_repeater' ), 10, 6 ); 176 177 178 } 179 180 181 return $prf_cla; 182 183 } 184 185 /** 186 * Placeholder for activation function 187 * 188 * @since 1.0.0 189 */ 190 public function activate() { 191 192 } 193 194 /** 195 * Placeholder for deactivation function 196 * 197 * @since 1.0.0 198 */ 199 public function deactivate() { 200 201 } 202 203 /** 204 * Initialize plugin for localization 205 * 206 * @since 1.0.0 207 */ 208 public function localization_setup() { 209 //load_plugin_textdomain( 'panda-pods-repeater-field', false, basename( dirname( __FILE__ ) ) . '/languages' ); 210 211 } 212 213 214 215 /** 216 * Enqueue admin scripts 217 * 218 * Allows plugin assets to be loaded. 219 * 220 * @since 1.0.0 221 */ 222 public function admin_enqueue_scripts() { 223 global $pprf_l10n, $wp_version; 224 /** 225 * All admin styles goes here 226 */ 227 wp_register_style( 'panda-pods-repeater-general-styles', plugins_url( 'css/general.min.css', __FILE__ ) ); 228 wp_enqueue_style( 'panda-pods-repeater-general-styles' ); 229 wp_register_style( 'panda-pods-repeater-admin-styles', plugins_url( 'css/admin.min.css', __FILE__ ), array( 'panda-pods-repeater-general-styles') ); 230 wp_enqueue_style( 'panda-pods-repeater-admin-styles' ); 231 232 /** 233 * All admin scripts goes here 234 */ 235 if( strpos( $_SERVER['REQUEST_URI'], 'wp-admin') && isset( $_GET ) && isset( $_GET['page'] ) && $_GET['page'] == 'panda-pods-repeater-field' ){ 236 wp_register_style('pprf_fields', plugins_url( 'fields/css/pprf.min.css', __FILE__ ), array( 'panda-pods-repeater-general-styles', 'panda-pods-repeater-admin-styles') ); 237 wp_enqueue_style('pprf_fields'); 238 239 } 240 241 242 wp_register_script( 'panda-pods-repeater-jquery-ui', plugins_url( 'library/js/jquery-ui.min.js', __FILE__ ), array( 'jquery' ), false, true ); 243 244 if ( version_compare( $wp_version, '5.9', '=' ) ) { 245 246 wp_register_script( 'panda-pods-repeater-admin-scripts', plugins_url( 'js/admin.min.js', __FILE__ ), array( 'jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'panda-pods-repeater-jquery-ui' ), false, true ); 247 } else { 248 wp_register_script( 'panda-pods-repeater-admin-scripts', plugins_url( 'js/admin.min.js', __FILE__ ), array( 'jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable' ), false, true ); 249 250 } 251 252 wp_enqueue_script( 'panda-pods-repeater-admin-scripts' ); 253 // prepare ajax 254 wp_localize_script( 255 'panda-pods-repeater-admin-scripts', 256 'ajax_script', 257 array( 258 'ajaxurl' => admin_url( 'admin-ajax.php' ), 259 'nonce' => wp_create_nonce( 'panda-pods-repeater-field-nonce' ), 260 ) 261 ); 262 263 wp_localize_script( 264 'panda-pods-repeater-admin-scripts', 265 'strs_obj', 266 $pprf_l10n 267 ); 268 $admin_url = substr( admin_url(), 0, strrpos( admin_url(), '/wp-admin/' ) + 10 ); 269 wp_localize_script( 270 'panda-pods-repeater-admin-scripts', 271 'PANDA_PODS_REPEATER_PAGE_URL', 272 array( $admin_url . '?page=panda-pods-repeater-field&' ) 273 ); 274 wp_localize_script( 275 'panda-pods-repeater-admin-scripts', 276 'PANDA_PODS_REPEATER_URL', 277 array( PANDA_PODS_REPEATER_URL ) 278 ); 279 /* wp_localize_script( 280 'panda-pods-repeater-admin-scripts', 281 '$_GETS', 282 $_GET 283 ); */ 284 //PANDA_PODS_REPEATER_URL 285 } 286 287 /** 288 * Adds an admin tab to Pods editor for all post types 289 * 290 * @param array $tabs The admin tabs 291 * @param object $pod Current Pods Object 292 * @param $addtl_args 293 * 294 * @return array 295 * 296 * @since 1.0.0 297 */ 298 function pt_tab( $tabs, $pod, $addtl_args ) { 299 $tabs[ 'panda-pods-repeater' ] = __( 'Panda Repeater Options', 'panda-pods-repeater-field' ); 300 301 return $tabs; 302 303 } 304 305 /** 306 * Adds options to Pods editor for post types 307 * 308 * @param array $options All the options 309 * @param object $pod Current Pods object. 310 * 311 * @return array 312 * 313 * @since 1.0.0 314 */ 315 function pt_options( $options, $pod ) { 316 317 $options[ 'panda-pods-repeater' ] = array( 318 'example_boolean' => array( 319 'label' => __( 'Enable something?', 'panda-pods-repeater-field' ), 320 'help' => __( 'Helpful info about this option that will appear in its help bubble', 'panda-pods-repeater-field' ), 321 'type' => 'boolean', 322 'default' => true, 323 'boolean_yes_label' => 'Yes' 324 ), 325 'example_text' => array( 326 'label' => __( 'Enter some text', 'panda-pods-repeater-field' ), 327 'help' => __( 'Helpful info about this option that will appear in its help bubble', 'panda-pods-repeater-field' ), 328 'type' => 'text', 329 'default' => 'Default text', 330 ), 331 'dependency_example' => array( 332 'label' => __( 'Dependency Example', 'panda-pods-repeater-field' ), 333 'help' => __( 'When set to true, this field reveals the field "dependent_example".', 'pods' ), 334 'type' => 'boolean', 335 'default' => false, 336 'dependency' => true, 337 'boolean_yes_label' => '' 338 ), 339 'dependent_example' => array( 340 'label' => __( 'Dependent Option', 'panda-pods-repeater-field' ), 341 'help' => __( 'This field is hidden unless the field "dependency_example" is set to true.', 'pods' ), 342 'type' => 'text', 343 'depends-on' => array( 'dependency_example' => true ) 344 ) 345 346 ); 347 348 return $options; 349 350 } 351 352 /** 353 * Adds a sub menu page to the Pods admin 354 * 355 * @param array $admin_menus The submenu items in Pods Admin menu. 356 * 357 * @return mixed 358 * 359 * @since 1.0.0 360 */ 361 function add_menu( $admin_menus ) { 362 $admin_menus[ 'panda_repeater'] = array( 363 'label' => __( 'Panda Repeater', 'panda-pods-repeater-field' ), 364 'function' => array( $this, 'menu_page' ), 365 'access' => 'manage_options' 366 367 ); 368 369 return $admin_menus; 370 371 } 372 373 /** 374 * This is the callback for the menu page. Be sure to create some actual functionality! 375 * 376 * @since 1.0.0 377 */ 378 function menu_page() { 379 echo '<h3>' . __( 'Panda Repeater', 'panda-pods-repeater-field' ) . '</h3>'; 380 381 } 382 /** 383 * not needed, now use pods_register_field_type 384 */ 385 function filter_pods_api_field_types( $field_types ){ 386 // print_r( $field_types ); 387 if( !in_array( 'pandarepeaterfield', $field_types ) ){ 388 array_push( $field_types, 'pandarepeaterfield' ); 389 390 } 391 return $field_types ; 392 } 393 /** 394 * not needed, now use pods_register_field_type 395 */ 396 function filter_pods_form_field_include( $pods_dir, $field_type ){ 397 //echo $pods_dir . ' ' . $field_type . '<br/>'; 398 if( 'pandarepeaterfield' == $field_type ){ 399 $pods_dir = dirname(__FILE__) . '/classes/podsfield_pandarepeaterfield.php'; 400 } 401 //$pods_dir = dirname(__FILE__) . '/classes/pods_repeater_table_as_field.php'; 402 return $pods_dir; 403 } 404 405 function filter_pods_form_ui_field_panda_repeater( $output, $name, $value, $options, $pod, $id ){ 406 //print_r( $output ); 407 return $output; 408 } 409 /** 410 * @deprecated 411 */ 412 private function instances(){ 413 global $wpdb, $current_user; 414 415 $query = $wpdb->prepare( 'SELECT COUNT(`post_id`) AS count FROM `' . $wpdb->postmeta . '` WHERE `meta_key` LIKE "type" AND `meta_value` LIKE "%s";', array( self::TYPE_NAME ) ); 416 417 $items = $wpdb->get_results( $query, ARRAY_A ); 418 419 return md5( $items[0]['count'] ) ; 420 421 } 422 /** 423 * register widgets 424 */ 425 // public function register_widgets() { 426 // \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\PPRF_Elementor_Accordion_Widget() ); 427 428 // } 429 } // Panda_Pods_Repeater_Field 430 38 define( 'PANDA_PODS_REPEATER_VERSION', '1.5.5' ); 39 40 /** 41 * To emable deleting item descendants. Add it to the configure.php file. Only do it to if you have daily backup and backup before deleting an item. The plugin author is not responsible for any data loss. 42 * 43 * @example define( 'PANDA_PODS_REPEATER_DELETE_ITEM_DESCENDANTS', true ); 44 */ 45 46 require_once PANDA_PODS_REPEATER_DIR . '/class-panda-pods-repeater-field.php'; 47 48 add_action( 'plugins_loaded', 'panda_repeater_safe_activate' ); 431 49 /** 432 50 * Initialize class, if Pods is active. 433 * 434 * @since 1.0.0 435 */ 436 add_action( 'plugins_loaded', 'panda_repeater_safe_activate'); 51 */ 437 52 function panda_repeater_safe_activate() { 438 439 //echo PODS_VERSION; 440 if ( defined( 'PANDA_PODS_REPEATER_VERSION' ) ) { 441 //$GLOBALS[ 'Panda_Pods_Repeater_Field' ] = Panda_Pods_Repeater_Field::init(); 442 443 } 444 if( function_exists( 'pods_register_field_type' ) ){ 445 pods_register_field_type( 'pandarepeaterfield', PANDA_PODS_REPEATER_DIR . 'classes/podsfield_pandarepeaterfield.php' ); 446 } 447 //plugin is activated 448 449 add_action( 'admin_menu', 'pprf_add_admin_menu' ); 53 define( 'PANDA_PODS_REPEATER_NONCE', wp_create_nonce( 'load-pprf-page' ) ); 54 if ( function_exists( 'pods_register_field_type' ) ) { 55 pods_register_field_type( 'pandarepeaterfield', PANDA_PODS_REPEATER_DIR . 'classes/class-podsfield-pandarepeaterfield.php' ); 56 } 57 // plugin is activated. 58 add_action( 'admin_menu', 'pprf_add_admin_menu' ); 450 59 } 451 60 … … 454 63 * 455 64 * @return mixed 456 * 457 * @since 1.0.0 458 */ 459 function pprf_add_admin_menu( ) { 460 461 $page = add_menu_page( __('Panda Pods Repeater Field', 'panda-pods-repeater-field' ), 'Panda Pods Repeater Field', 'edit_posts', 'panda-pods-repeater-field', 'pprf_main_page' ); 462 463 //add_action('load-' . $page_str, 'pprf_load_field' ); 464 465 } 466 467 function pprf_main_page(){ 468 /* don't need Emoji and smiley js */ 469 //remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); 470 //remove_action( 'wp_print_styles', 'print_emoji_styles' ); 471 //add_action('admin_menu', 'pprf_remove_admin_menu_items'); 472 473 include_once( PANDA_PODS_REPEATER_DIR . 'fields/pandarepeaterfield.php'); 474 //die( ); 475 } 476 477 /** 478 * Remove Unwanted Admin Menu Items 65 */ 66 function pprf_add_admin_menu() { 67 68 $page = add_menu_page( __( 'Panda Pods Repeater Field', 'panda-pods-repeater-field' ), 'Panda Pods Repeater Field', 'edit_posts', 'panda-pods-repeater-field', 'pprf_main_page' ); 69 } 70 /** 71 * Include the field file 72 */ 73 function pprf_main_page() { 74 include_once PANDA_PODS_REPEATER_DIR . 'fields/pandarepeaterfield.php'; 75 } 76 77 /** 78 * Remove Unwanted Admin Menu Items 79 * 479 80 * @link https://managewp.com/wordpress-admin-sidebar-remove-unwanted-items 480 81 **/ 481 82 function pprf_remove_admin_menu_items() { 482 $remove_menu_items = array( __('Links'));83 $remove_menu_items = array( __( 'Links' ) ); 483 84 global $menu; 484 end ($menu); 485 while (prev($menu)){ 486 $item = explode(' ',$menu[key($menu)][0]); 487 if( in_array($item[0] != NULL?$item[0]:"" , $remove_menu_items)){ 488 unset($menu[key($menu)]);} 489 } 490 } 491 492 493 /* 494 * load_fn 495 * 496 * @description: 497 * @created: 27/05/16 498 */ 499 500 function pprf_load_field(){ 501 502 // include export action 503 //if( isset( $_GET ) && isset( $_GET['csv'] ) ){ 504 include_once( PANDA_PODS_REPEATER_DIR . 'fields/pandarepeaterfield.php'); 505 die( ); 506 //} 85 end( $menu ); 86 while ( prev( $menu ) ) { 87 $item = explode( ' ', $menu[ key( $menu ) ][0] ); 88 if ( in_array( null !== $item[0] ? $item[0] : '', $remove_menu_items, true ) ) { 89 unset( $menu[ key( $menu ) ] );} 90 } 91 } 92 93 /** 94 * Include the field file 95 */ 96 function pprf_load_field() { 97 include_once PANDA_PODS_REPEATER_DIR . 'fields/pandarepeaterfield.php'; 98 die(); 507 99 } 508 100 /** 509 101 * Initialize class, if Pods is active. 510 * 511 * @since 1.0.0 512 */ 513 if( is_admin() ){ 514 add_action( 'admin_init', 'check_some_other_plugin', 20 ); 102 */ 103 if ( is_admin() ) { 104 add_action( 'admin_init', 'check_some_other_plugin', 20 ); 515 105 } else { 516 add_action( 'init', 'check_some_other_plugin', 20 ); 517 } 518 106 add_action( 'init', 'check_some_other_plugin', 20 ); 107 } 108 /** 109 * If Pods is active, create an instance of the repeater field. 110 */ 519 111 function check_some_other_plugin() { 520 521 //if ( is_plugin_active( 'pods/init.php' ) ) { 112 522 113 if ( defined( 'PODS_VERSION' ) ) { 523 $GLOBALS[ 'Panda_Pods_Repeater_Field' ] = Panda_Pods_Repeater_Field::init(); 524 525 } 526 //} 527 528 } 529 530 114 $GLOBALS['Panda_Pods_Repeater_Field'] = Panda_Pods_Repeater_Field::init(); 115 } 116 } 117 118 add_action( 'admin_notices', 'panda_repeater_admin_notice_pods_not_active' ); 531 119 /** 532 120 * Throw admin nag if Pods isn't activated. 533 121 * 534 * Will only show on the plugins page. 535 * 536 * @since 1.0.0 537 */ 538 add_action( 'admin_notices', 'panda_repeater_admin_notice_pods_not_active' ); 122 * It will only show on the plugins page. 123 */ 539 124 function panda_repeater_admin_notice_pods_not_active() { 540 125 541 126 if ( ! defined( 'PODS_VERSION' ) ) { 542 127 543 // use the global pagenow so we can tell if we are on plugins admin page128 // use the global pagenow so we can tell if we are on plugins admin page. 544 129 global $pagenow; 545 if ( $pagenow == 'plugins.php') {130 if ( 'plugins.php' === $pagenow ) { 546 131 ?> 547 132 <div class="error"> 548 133 <p><?php esc_html_e( 'You have activated Panda Pods Repeater Field. Pods Framework plugin required.', 'panda-pods-repeater-field' ); ?></p> 549 134 </div> 550 <?php 551 552 } //endif on the right page 553 } //endif Pods is not active 554 555 } 556 557 /** 558 * Throw admin nag if Pods minimum version is not met 559 * 560 * Will only show on the Pods admin page 561 * 562 * @since 1.0.0 563 */ 135 <?php 136 137 } 138 } 139 140 } 141 142 564 143 add_action( 'admin_notices', 'panda_repeater_admin_notice_pods_min_version_fail' ); 144 /** 145 * Throw admin nag if Pods minimum version is not met. 146 * 147 * It will only show on the Pods admin page. 148 */ 565 149 function panda_repeater_admin_notice_pods_min_version_fail() { 566 150 567 151 if ( defined( 'PODS_VERSION' ) ) { 568 152 569 // set minimum supported version of Pods.153 // set minimum supported version of Pods. 570 154 $minimum_version = '2.3.18'; 571 155 572 // check if Pods version is greater than or equal to minimum supported version for this plugin573 if ( version_compare( $minimum_version, PODS_VERSION ) > 0) {574 575 // create $page variable to check if we are on pods admin page576 $page = pods_v( 'page','get', false, true );577 578 // check if we are on Pods Admin page579 if ( $page === 'pods') {156 // check if Pods version is greater than or equal to minimum supported version for this plugin. 157 if ( version_compare( $minimum_version, PODS_VERSION ) > 0 ) { 158 159 // create $page variable to check if we are on pods admin page. 160 $page = pods_v( 'page', 'get', false, true ); 161 162 // check if we are on Pods Admin page. 163 if ( 'pods' === $page ) { 580 164 ?> 581 165 <div class="updated"> 582 166 <p><?php esc_html_e( 'Panda Pods Repeater Field requires Pods version 2.3.18 or later.', 'panda-pods-repeater-field' ); ?></p> 583 167 </div> 584 <?php 585 586 } //endif on the right page 587 } //endif version compare 588 } //endif Pods is not active 589 168 <?php 169 170 } //endif on the right page. 171 } //endif version compare. 172 } //endif Pods is not active. 590 173 591 174 } 592 175 593 176 add_action( 'wp_loaded', 'pprf_translate' ); 594 595 function pprf_translate(){ 596 // translation 597 $strings = array( 598 'be_restored' => esc_html__( 'It will be restored.', 'panda-pods-repeater-field' ), 599 'can_recover' => esc_html__( 'You can recover it from trash.', 'panda-pods-repeater-field' ), 600 'be_deleted' => esc_html__( 'It will be deleted permanently.', 'panda-pods-repeater-field' ), 601 'you_sure' => esc_html__( 'Are you sure?', 'panda-pods-repeater-field' ), 602 'Ignore_changes' => esc_html__( 'It seems like you have made some changes in a repeater field. Ignore the changes?', 'panda-pods-repeater-field' ), 177 /** 178 * Translations for localization 179 */ 180 function pprf_translate() { 181 182 $strings = array( 183 'be_restored' => esc_html__( 'It will be restored.', 'panda-pods-repeater-field' ), 184 'can_recover' => esc_html__( 'You can recover it from trash.', 'panda-pods-repeater-field' ), 185 'be_deleted' => esc_html__( 'It will be deleted permanently.', 'panda-pods-repeater-field' ), 186 'you_sure' => esc_html__( 'Are you sure?', 'panda-pods-repeater-field' ), 187 'Ignore_changes' => esc_html__( 'It seems like you have made some changes in a repeater field. Ignore the changes?', 'panda-pods-repeater-field' ), 603 188 ); 604 189 $GLOBALS['pprf_l10n'] = $strings; 605 190 } 606 191 /** 607 * pandarf_pods_data extension of pods( $table, $params ) 608 * 609 * @param string $tb_str repeater field table 610 * @param array $searches search repeater field table array( 611 'pod_id': parent pod id 612 'post_id: parent post id 613 'pod_field_id' pod field id 614 ) 615 * @param array $params_arr an array to pass into pods( $table, $params ) 616 * @user pods( $table, $param ) 617 */ 618 function pandarf_pods_data( $tb_str, $searches = array( 'pod_id' => '', 'post_id' => '', 'pod_field_id' => '' ), $params_arr = array() ){ 619 if( !is_numeric( $searches['pod_id'] ) || !is_numeric( $searches['post_id'] ) || !is_numeric( $searches['pod_field_id'] ) ){ 620 return array(); 621 } 622 $files_arr = array('panda_pods_repeater_field_db'); 623 624 $class_bln = true; 625 $file_str = dirname(__FILE__) . '/classes/' . $files_arr[ 0 ] . '.php'; 626 627 if( file_exists( $file_str ) ) { 628 $claName_str = str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $files_arr[ 0 ] ) ) ) ) ; 629 include_once $file_str; 630 631 $db_cla = new panda_pods_repeater_field_db(); 632 $table_info = $db_cla->get_pods_tb_info( 'pods_' . $tb_str ); 633 $tbabbr_str = $table_info['type'] == 'pod'? 't' : 'd'; 634 635 $where_sql = ' `' . $tbabbr_str . '`.`pandarf_parent_pod_id` = ' . intval( $searches['pod_id'] ) . ' 636 AND `' . $tbabbr_str . '`.`pandarf_parent_post_id` = "' . intval( $searches['post_id'] ) . '" 637 AND `' . $tbabbr_str . '`.`pandarf_pod_field_id` = ' . intval( $searches['pod_field_id'] ) . ' '; 638 if( isset( $params_arr['where'] ) && $params_arr['where'] != '' ){ 639 $params_arr['where'] .= ' AND ' . $where_sql; 192 * Extension of pods( $table, $params ) 193 * 194 * @param string $table repeater field table. 195 * @param array $searches search repeater field table array( 'pod_id': parent pod id, 'post_id: parent post id, 'pod_field_id' pod field id ). 196 * @param array $params an array to pass into pods( $table, $params ). 197 * @uses pods( $table, $param ) 198 */ 199 function pandarf_pods_data( $table, $searches = array( 200 'pod_id' => '', 201 'post_id' => '', 202 'pod_field_id' => '', 203 ), 204 $params = array() 205 ) { 206 if ( ! is_numeric( $searches['pod_id'] ) || ! is_numeric( $searches['post_id'] ) || ! is_numeric( $searches['pod_field_id'] ) ) { 207 return array(); 208 } 209 $files_arr = array( 'panda_pods_repeater_field_db' ); 210 211 $class_bln = true; 212 $file_str = dirname( __FILE__ ) . '/classes/' . $files_arr[0] . '.php'; 213 214 if ( file_exists( $file_str ) ) { 215 $class_name = str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $files_arr[0] ) ) ) ); 216 include_once $file_str; 217 218 $db_cla = new Panda_Pods_Repeater_Field_DB(); 219 $table_info = $db_cla->get_pods_tb_info( 'pods_' . $table ); 220 $table_short = 'pod' === $table_info['type'] ? 't' : 'd'; 221 222 $where_sql = ' `' . $table_short . '`.`pandarf_parent_pod_id` = ' . intval( $searches['pod_id'] ) . ' 223 AND `' . $table_short . '`.`pandarf_parent_post_id` = "' . intval( $searches['post_id'] ) . '" 224 AND `' . $table_short . '`.`pandarf_pod_field_id` = ' . intval( $searches['pod_field_id'] ) . ' '; 225 if ( isset( $params['where'] ) && '' !== $params['where'] ) { 226 $params['where'] .= ' AND ' . $where_sql; 640 227 } else { 641 $params_arr['where'] = $where_sql; 642 } 643 644 $pod_cla = pods( $tb_str, $params_arr ); 645 646 $rows_obj = $pod_cla->data(); 647 648 649 return $rows_obj; 650 } 651 652 } 653 654 /** 655 * fetch child pod data 656 * 657 * @param array $fields search repeater field table array( 658 'id' => '', 659 'name' => '', //the common name field used by pods 660 'child_pod_name' => '', //repeater table name 661 'parent_pod_id' => '', //main table pod id 662 'parent_pod_post_id' => '', //main table post id 663 'parent_pod_field_id' => '', //main table pod Panda Pod Repeater Field id 664 ) 665 * @param array $attrs search repeater field table array( 666 'where' => '', //exter where, expected to be escaped 667 'order' => 'ASC', 668 'order_by' => 'pandarf_order', 669 'group_by' => '', 670 'start' => 0, 671 'limit' => 0, 672 'count_only' => false, 673 'full_child_pod_name' => false, //if child_pod_name is a full table name, $wpdb->prefix and pods_ won't be added to the table name 674 ) 228 $params['where'] = $where_sql; 229 } 230 231 $pod = pods( $table, $params ); 232 233 $rows = $pod->data(); 234 235 return $rows; 236 } 237 238 } 239 240 /** 241 * Fetch child pod data 242 * 243 * @param array $fields Search repeater field table. See the $filters in the function for the expected elements. 244 * @param array $attrs Search repeater field table. See the $defaults in the function for the expected elements. 245 * @param boolean $show_query Fo developers to debug. 246 * 675 247 * @return array $items_arr; 676 248 */ 677 function get_pandarf_items( $fields = array(), $attrs = array(), $show Query_bln = false ){249 function get_pandarf_items( $fields = array(), $attrs = array(), $show_query = false ) { 678 250 679 251 global $wpdb; 680 252 681 $filters =array(682 'id' => '',683 'name' => '',684 'child_pod_name' => '',685 'parent_pod_id' => '',686 'parent_pod_post_id' => '',687 'parent_pod_field_id' => '',688 ); 689 $filters = wp_parse_args( $fields, $filters ); 690 691 $defaults = array(692 'where' => '', 693 'order'=> 'ASC',694 'order_by'=> 'pandarf_order',695 'group_by' => '',696 'start' => 0,697 'limit' => 0,698 'count_only'=> false,699 'full_child_pod_name' => false,700 'include_trashed'=> false,701 ); 702 $attrs = wp_parse_args( $attrs, $defaults );253 $filters = array( 254 'id' => '', 255 'name' => '', // the common name field used by pods. 256 'child_pod_name' => '', // repeater table name. 257 'parent_pod_id' => '', // main table pod id. 258 'parent_pod_post_id' => '', // main table post id. 259 'parent_pod_field_id' => '', // main table pod Panda Pod Repeater Field id. 260 ); 261 $filters = wp_parse_args( $fields, $filters ); 262 263 $defaults = array( 264 'where' => '', // extend where, expected to be escaped. 265 'order' => 'ASC', 266 'order_by' => 'pandarf_order', 267 'group_by' => '', 268 'start' => 0, 269 'limit' => 0, 270 'count_only' => false, 271 'full_child_pod_name' => false, // if child_pod_name is a full table name, $wpdb->prefix and pods_ won't be added to the table name. 272 'include_trashed' => false, 273 ); 274 $attrs = wp_parse_args( $attrs, $defaults ); 703 275 704 276 $para_arr = array(); 705 277 $where_sql = ''; 706 if ( is_numeric( $filters['id'] ) ){278 if ( is_numeric( $filters['id'] ) ) { 707 279 $where_sql .= ' AND `id` = %d'; 708 array_push( $para_arr, $filters['id'] ); 709 } 710 if ( $filters['name'] != '' ){711 if ( is_numeric( $filters['name'] ) ){712 // if putting a dot at the end of an number, like 24., strpos will return false so it is treated as an integer 713 $value_type = strpos( $filters['name'], '.' ) !== false ? '%f' : '%d';280 array_push( $para_arr, $filters['id'] ); 281 } 282 if ( '' !== $filters['name'] ) { 283 if ( is_numeric( $filters['name'] ) ) { 284 // if putting a dot at the end of an number, like 24., strpos will return false so it is treated as an integer. 285 $value_type = false !== strpos( $filters['name'], '.' ) ? '%f' : '%d'; 714 286 } else { 715 $value_type = '%s';287 $value_type = '%s'; 716 288 } 717 289 $where_sql .= ' AND `name` = ' . $value_type . ''; 718 array_push( $para_arr, $filters['name'] ); 719 } 720 if ( is_numeric( $filters['parent_pod_id'] ) ){290 array_push( $para_arr, $filters['name'] ); 291 } 292 if ( is_numeric( $filters['parent_pod_id'] ) ) { 721 293 $where_sql .= ' AND `pandarf_parent_pod_id` = %d'; 722 array_push( $para_arr, $filters['parent_pod_id'] ); 723 } 724 if ( is_numeric( $filters['parent_pod_post_id'] ) ){294 array_push( $para_arr, $filters['parent_pod_id'] ); 295 } 296 if ( is_numeric( $filters['parent_pod_post_id'] ) ) { 725 297 $where_sql .= ' AND `pandarf_parent_post_id` = %d'; 726 array_push( $para_arr, $filters['parent_pod_post_id'] ); 727 } 728 if ( is_numeric( $filters['parent_pod_field_id'] ) ){298 array_push( $para_arr, $filters['parent_pod_post_id'] ); 299 } 300 if ( is_numeric( $filters['parent_pod_field_id'] ) ) { 729 301 $where_sql .= ' AND `pandarf_pod_field_id` = %d'; 730 array_push( $para_arr, $filters['parent_pod_field_id'] ); 731 } 732 733 //exit( $where_sql ); 302 array_push( $para_arr, $filters['parent_pod_field_id'] ); 303 } 304 734 305 $group_by = ''; 735 if ( $attrs['group_by'] != '' ){736 $group_by = 'GROUP BY( ' . esc_sql( $attrs['group_by'] ) . ' )';737 } 738 739 $limit_sql = '';740 if ( ! empty( $attrs['limit'] ) ){306 if ( '' !== $attrs['group_by'] ) { 307 $group_by = 'GROUP BY( ' . esc_sql( $attrs['group_by'] ) . ' )'; 308 } 309 310 $limit_sql = ''; 311 if ( ! empty( $attrs['limit'] ) ) { 741 312 $limit_sql = 'LIMIT ' . esc_sql( intval( $attrs['start'] ) ) . ', ' . esc_sql( intval( $attrs['limit'] ) ) . ''; 742 313 } 743 314 744 745 if( $attrs['count_only'] === false ){ 746 $fields_str = ' * ' ; 315 if ( false === $attrs['count_only'] ) { 316 $fields_sql = ' * '; 747 317 } else { 748 $fields_s tr = ' COUNT( `id` ) AS "count"';749 } 750 751 $where_sql .= ' ' . $attrs['where'] . ' ';752 $table_str = esc_sql( $filters['child_pod_name'] );753 if ( $attrs['full_child_pod_name'] == false ){754 $table_str = $wpdb->prefix . 'pods_' . $table_str;755 } 756 757 $parent_post =get_post( $filters['parent_pod_id'] );758 if ( $parent_post ){759 $parent_pod = pods( $parent_post->post_name );760 foreach ( $parent_pod->fields as $k_str => $field ){761 762 if ( is_array( $field ) ){763 $field = (object) $field ; // so it works in before and after pods 2.8764 } 765 if ( is_object( $field ) ){766 if ( isset( $field->type ) && $field->type == 'pandarepeaterfield' && $filters['parent_pod_field_id']== $field->id ) {767 768 if ( isset( $field->options['pandarepeaterfield_enable_trash'] ) && $field->options['pandarepeaterfield_enable_trash'] == 1 && false == $attrs['include_trashed'] ){ // if trash enabled, also not forced to include trashed only load those not trashed318 $fields_sql = ' COUNT( `id` ) AS "count"'; 319 } 320 321 $where_sql .= ' ' . $attrs['where'] . ' '; 322 $table_str = esc_sql( $filters['child_pod_name'] ); 323 if ( false === $attrs['full_child_pod_name'] ) { 324 $table_str = $wpdb->prefix . 'pods_' . $table_str; 325 } 326 327 $parent_post = get_post( $filters['parent_pod_id'] ); 328 if ( $parent_post ) { 329 $parent_pod = pods( $parent_post->post_name ); 330 foreach ( $parent_pod->fields as $k_str => $field ) { 331 332 if ( is_array( $field ) ) { 333 $field = (object) $field; // so it works in before and after pods 2.8. 334 } 335 if ( is_object( $field ) ) { 336 if ( isset( $field->type ) && 'pandarepeaterfield' === $field->type && $filters['parent_pod_field_id'] === $field->id ) { 337 338 if ( isset( $field->options['pandarepeaterfield_enable_trash'] ) && ! empty( $field->options['pandarepeaterfield_enable_trash'] ) && false === $attrs['include_trashed'] ) { // if trash enabled, also not forced to include trashed only load those not trashed. 769 339 $where_sql .= ' AND `pandarf_trash` != 1'; 770 340 771 341 } 772 if ( isset( $field->options['pandarepeaterfield_order_by'] ) && !empty( $field->options['pandarepeaterfield_order_by'] ) ){ // different order field773 if ( $attrs['order_by'] == 'pandarf_order' && !empty( $field->options['pandarepeaterfield_order_by'] ) ){ // if not changed by the filter, load the saved one774 $attrs['order_by'] = $field->options['pandarepeaterfield_order_by'] ;342 if ( isset( $field->options['pandarepeaterfield_order_by'] ) && ! empty( $field->options['pandarepeaterfield_order_by'] ) ) { // different order field. 343 if ( 'pandarf_order' === $attrs['order_by'] && ! empty( $field->options['pandarepeaterfield_order_by'] ) ) { // if not changed by the filter, load the saved one. 344 $attrs['order_by'] = sanitize_text_field( wp_unslash( $field->options['pandarepeaterfield_order_by'] ) ); 775 345 } 776 } 777 if ( isset( $field->options['pandarepeaterfield_order'] ) && !empty( $field->options['pandarepeaterfield_order'] ) ){ // different order field778 if ( $attrs['order'] == 'ASC' ){ // if not changed by the filter, load the saved one779 $attrs['order'] = $field->options['pandarepeaterfield_order']; 346 } 347 if ( isset( $field->options['pandarepeaterfield_order'] ) && ! empty( $field->options['pandarepeaterfield_order'] ) ) { // different order field. 348 if ( 'ASC' === $attrs['order'] ) { // if not changed by the filter, load the saved one. 349 $attrs['order'] = $field->options['pandarepeaterfield_order']; 780 350 } 781 } 782 break; 351 } 352 break; 783 353 } 784 785 } 786 } 787 } 788 789 $order_sql = ''; 790 if( $attrs['order_by'] != '' ){ 791 if( $attrs['order_by'] == 'random' ){ 354 } 355 } 356 } 357 358 $order_sql = ''; 359 if ( '' !== $attrs['order_by'] ) { 360 if ( 'random' === $attrs['order_by'] ) { 792 361 $order_sql = 'ORDER BY RAND()'; 793 362 } else { 794 795 if ( $attrs['order'] != 'ASC' ){796 $attrs['order'] = 'DESC'; 797 } 798 if ( $attrs['order_by'] == 'pandarf_order' ){799 $order_sql = 'ORDER BY CAST( ' . esc_sql( $attrs['order_by'] ) . ' AS UNSIGNED ) ' . $attrs['order'] . '' ;363 364 if ( 'ASC' !== $attrs['order'] ) { 365 $attrs['order'] = 'DESC'; 366 } 367 if ( 'pandarf_order' === $attrs['order_by'] ) { 368 $order_sql = 'ORDER BY CAST( ' . esc_sql( $attrs['order_by'] ) . ' AS UNSIGNED ) ' . $attrs['order'] . ''; 800 369 } else { 801 370 $order_sql = 'ORDER BY ' . esc_sql( $attrs['order_by'] ) . ' ' . $attrs['order'] . ''; 802 371 } 803 372 } 804 } 805 // find out the file type 806 $join_sql = ''; 807 $child_pod = pods( $filters['child_pod_name'] ); 808 809 810 if( pprf_updated_tables( $filters['child_pod_name'] ) == false ){ 811 $file_str = dirname(__FILE__) . '/classes/panda_pods_repeater_field_db.php'; 812 if( file_exists( $file_str ) ) { 813 include_once $file_str; 814 $db_cla = new panda_pods_repeater_field_db(); 815 $db_cla->update_columns( $filters['child_pod_name'] ); 816 } 817 } 818 819 if( is_object( $child_pod ) && $attrs['count_only'] == false ){ 820 $i = 0; 821 foreach( $child_pod->fields as $k_str => $field ){ 822 if( is_array( $field ) ){ 823 $field = (object)$field ; 824 } 825 if( is_object( $field ) ){ 826 827 $relatePick_arr = array('user', 'post_type', 'pod', 'media'); 828 if( ( isset( $field->type ) && $field->type == 'file' ) || ( isset( $field->type ) && $field->type == 'pick' && in_array( $field->pick_object, $relatePick_arr ) ) ){ 829 830 $fields_str .= ',( 831 SELECT GROUP_CONCAT( psl' . $i . '_tb.related_item_id ORDER BY psl' . $i . '_tb.weight ASC SEPARATOR "," ) 832 FROM `' . $wpdb->prefix . 'podsrel` AS psl' . $i . '_tb 833 WHERE psl' . $i . '_tb.pod_id = "' . $child_pod->pod_id . '" 834 AND psl' . $i . '_tb.field_id = "' . $field->id . '" 835 AND psl' . $i . '_tb.item_id = pod_tb.id 836 GROUP BY psl' . $i . '_tb.item_id 837 ) AS ' . $k_str; 838 839 $i++; 840 } 841 } 842 } 843 } 844 if( count( $para_arr ) > 0 ){ 845 $query = $wpdb->prepare( 'SELECT ' . $fields_str . ' FROM `' . $table_str . '` AS pod_tb ' . $join_sql . ' WHERE 1=1 ' . $where_sql . ' ' . $group_by . ' ' . $order_sql . ' ' . $limit_sql , $para_arr ); 373 } 374 // Find out the file type. 375 $join_sql = ''; 376 $child_pod = pods( $filters['child_pod_name'] ); 377 378 if ( false === pprf_updated_tables( $filters['child_pod_name'] ) ) { 379 $file = dirname( __FILE__ ) . '/classes/class-panda-pods-repeater-field-db.php'; 380 if ( file_exists( $file ) ) { 381 include_once $file; 382 $db_cla = new panda_pods_repeater_field_db(); 383 $db_cla->update_columns( $filters['child_pod_name'] ); 384 } 385 } 386 387 if ( is_object( $child_pod ) && false === $attrs['count_only'] ) { 388 $i = 0; 389 foreach ( $child_pod->fields as $k_str => $field ) { 390 if ( is_array( $field ) ) { 391 $field = (object) $field; 392 } 393 if ( is_object( $field ) ) { 394 395 $relate_types = array( 'user', 'post_type', 'pod', 'media' ); 396 if ( ( isset( $field->type ) && 'file' === $field->type ) || ( isset( $field->type ) && 'pick' === $field->type && in_array( $field->pick_object, $relate_types, true ) ) ) { 397 398 $fields_sql .= ',( 399 SELECT GROUP_CONCAT( psl' . $i . '_tb.related_item_id ORDER BY psl' . $i . '_tb.weight ASC SEPARATOR "," ) 400 FROM `' . $wpdb->prefix . 'podsrel` AS psl' . $i . '_tb 401 WHERE psl' . $i . '_tb.pod_id = "' . $child_pod->pod_id . '" 402 AND psl' . $i . '_tb.field_id = "' . $field->id . '" 403 AND psl' . $i . '_tb.item_id = pod_tb.id 404 GROUP BY psl' . $i . '_tb.item_id 405 ) AS ' . $k_str; 406 407 $i++; 408 } 409 } 410 } 411 } 412 if ( count( $para_arr ) > 0 ) { 413 $query = $wpdb->prepare( 414 // phpcs:ignore 415 'SELECT ' . $fields_sql . ' FROM `' . $table_str . '` AS pod_tb ' . $join_sql . ' WHERE 1=1 ' . $where_sql . ' ' . $group_by . ' ' . $order_sql . ' ' . $limit_sql, 416 $para_arr 417 ); 846 418 } else { 847 $query = 'SELECT ' . $fields_str . ' FROM `' . $table_str . '` AS pod_tb ' . $join_sql . ' WHERE 1=1 ' . $where_sql . ' ' . $group_by . ' ' . $order_sql . ' ' . $limit_sql; 848 } 849 //echo $query; 850 if( $showQuery_bln ){ 851 echo $query; 852 } 853 854 $items = $wpdb->get_results( $query , ARRAY_A ); 855 856 return $items; 419 $query = 'SELECT ' . $fields_sql . ' FROM `' . $table_str . '` AS pod_tb ' . $join_sql . ' WHERE 1=1 ' . $where_sql . ' ' . $group_by . ' ' . $order_sql . ' ' . $limit_sql; 420 } 421 422 if ( $show_query ) { 423 echo esc_html( $query ); 424 } 425 426 $items = $wpdb->get_results( 427 // phpcs:ignore 428 $query, 429 ARRAY_A 430 ); // db call ok. no-cache ok. 431 432 return $items; 857 433 } 858 434 /** 859 435 * Alias of get_pandarf_items 860 */ 861 function pandarf_items_fn( $fields = array(), $attrs = array(), $show_query = false ){ 862 436 * 437 * @param array $fields Search repeater field table. See the $filters in the function for the expected elements. 438 * @param array $attrs Search repeater field table. See the $defaults in the function for the expected elements. 439 * @param boolean $show_query Fo developers to debug. 440 * 441 * @return array $items_arr; 442 */ 443 function pandarf_items_fn( $fields = array(), $attrs = array(), $show_query = false ) { 444 863 445 return get_pandarf_items( $fields, $attrs, $show_query ); 864 446 } 865 447 /** 866 * pandarf_insert insert data to panda repeater field table 867 * 868 * @param array $fields extra fields other than panda repeater fields to insert array( 'field_name' => '', 'field_name' => '' ... ) 869 * @param array $attrs search repeater field table array( 870 'child_pod_name' => '', repeater table name 871 'parent_pod_id' => '', main table pod id 872 'parent_pod_post_id' => '', main table post id 873 'parent_pod_field_id' => '', main table pod Panda Pod Repeater Field id 874 'user_id' => 0, The author id 875 'full_child_pod_name' => false, //if child_pod_name is a full table name, $wpdb->prefix and pods_ won't be added to the table name 876 ) 448 * Insert data to panda repeater field table 449 * 450 * @param array $fields extra fields other than panda repeater fields to insert array( 'field_name' => '', 'field_name' => '' ... ). 451 * @param array $attrs search repeater field table. See $defaults in the function. 452 * @param boolean $show_query Fo developers to debug. 453 * 877 454 * @return boolean $done; 878 455 */ 879 function pandarf_insert( $fields = array(), $attrs = array(), $show_bln = false ){ 880 881 global $wpdb, $current_user; 882 883 $defaults = array( 884 'child_pod_name' => '', 885 'parent_pod_id' => '', 886 'parent_pod_post_id' => '', 887 'parent_pod_field_id' => '', 888 'user_id' => $current_user->ID, 889 'full_child_pod_name' => false, 890 ); 891 892 $attrs = wp_parse_args( $attrs, $defaults ); 893 894 $now = date('Y-m-d H:i:s'); 895 $table = esc_sql( $attrs['child_pod_name'] ); 896 if( $attrs['full_child_pod_name'] == false ){ 897 $table = $wpdb->prefix . 'pods_' . $table; 898 } 899 $para_arr = array(); 900 $where_sql = ''; 901 // get the last order 902 $query = $wpdb->prepare( 'SELECT MAX( CAST(`pandarf_order` AS UNSIGNED) ) AS last_order FROM `' . $table . '` WHERE `pandarf_parent_pod_id` = %d AND `pandarf_parent_post_id` = "%s" AND `pandarf_pod_field_id` = %d' , array( $attrs['parent_pod_id'], $attrs['parent_pod_post_id'], $attrs['parent_pod_field_id'] ) ); 903 904 $order_arr = $wpdb->get_results( $query, ARRAY_A ); 905 906 $order_int = count( $order_arr ) > 0 ? $order_arr[0]['last_order'] + 1 : 1; 907 908 $pandarf_data = array( 909 'pandarf_parent_pod_id' => $attrs['parent_pod_id'], 910 'pandarf_parent_post_id' => $attrs['parent_pod_post_id'], 911 'pandarf_pod_field_id' => $attrs['parent_pod_field_id'], 912 'pandarf_created' => $now, 913 'pandarf_modified' => $now, 914 'pandarf_modified_author' => $attrs['user_id'], 915 'pandarf_author' => $attrs['user_id'], 916 'pandarf_order' => $order_int, 917 ); 918 919 // insert 920 $values_arr = array(); 921 $keys = array(); 922 //$fields = array_merge( $fields, $pandarf_data ); 923 $vals_arr = array(); 924 //foreach( $fields as $k_str => $v_str ){ 925 foreach( $pandarf_data as $k_str => $v_str ){ 926 array_push( $keys, '`' . esc_sql( $k_str ) . '`' ); 927 if( is_numeric( $v_str ) ){ 928 // if putting a dot at the end of an number, like 24., strpos will return false so it is treated as an integer 929 $value_type = strpos( $v_str, '.' ) !== false ? '%f' : '%d'; 930 931 array_push( $vals_arr, $value_type ); 932 933 } else if( is_array( $v_str ) ){ 934 array_push( maybe_serialize( $vals_arr ), '%s' ); 456 function pandarf_insert( $fields = array(), $attrs = array(), $show_query = false ) { 457 458 global $wpdb, $current_user; 459 460 $defaults = array( 461 'child_pod_name' => '', // Repeater table name. 462 'parent_pod_id' => '', // Main table pod id. 463 'parent_pod_post_id' => '', // Main table post id. 464 'parent_pod_field_id' => '', // Main table pod Panda Pod Repeater Field id. 465 'user_id' => $current_user->ID, // 0, The author id. 466 'full_child_pod_name' => false, // If child_pod_name is a full table name, $wpdb->prefix and pods_ won't be added to the table name. 467 ); 468 469 $attrs = wp_parse_args( $attrs, $defaults ); 470 471 if ( empty( $attrs['child_pod_name'] ) || ! is_numeric( $attrs['parent_pod_id'] ) || ! is_numeric( $attrs['parent_pod_post_id'] ) || ! is_numeric( $attrs['parent_pod_field_id'] ) || ! is_numeric( $attrs['user_id'] ) ) { 472 return false; 473 } 474 $now = gmddate( 'Y-m-d H:i:s' ); 475 $table = esc_sql( $attrs['child_pod_name'] ); 476 if ( false === $attrs['full_child_pod_name'] ) { 477 $table = $wpdb->prefix . 'pods_' . $table; 478 } 479 $para_arr = array(); 480 $where_sql = ''; 481 // get the last order. 482 $query = $wpdb->prepare( 'SELECT MAX( CAST(`pandarf_order` AS UNSIGNED) ) AS last_order FROM `%s` WHERE `pandarf_parent_pod_id` = %d AND `pandarf_parent_post_id` = %s AND `pandarf_pod_field_id` = %d', array( $table, $attrs['parent_pod_id'], $attrs['parent_pod_post_id'], $attrs['parent_pod_field_id'] ) ); 483 484 $order_arr = $wpdb->get_results( 485 // phpcs:ignore 486 $query, 487 ARRAY_A 488 ); // db call ok. no-cache ok. 489 490 $order_int = count( $order_arr ) > 0 ? $order_arr[0]['last_order'] + 1 : 1; 491 492 $pandarf_data = array( 493 'pandarf_parent_pod_id' => $attrs['parent_pod_id'], 494 'pandarf_parent_post_id' => $attrs['parent_pod_post_id'], 495 'pandarf_pod_field_id' => $attrs['parent_pod_field_id'], 496 'pandarf_created' => $now, 497 'pandarf_modified' => $now, 498 'pandarf_modified_author' => $attrs['user_id'], 499 'pandarf_author' => $attrs['user_id'], 500 'pandarf_order' => $order_int, 501 ); 502 503 // Insert. 504 $values_arr = array(); 505 $keys = array(); 506 $placeholders = array(); 507 508 foreach ( $pandarf_data as $k_str => $v_str ) { 509 array_push( $keys, '`' . esc_sql( $k_str ) . '`' ); 510 if ( is_numeric( $v_str ) ) { 511 // If putting a dot at the end of an number, like 24., strpos will return false so it is treated as an integer. 512 $value_type = strpos( $v_str, '.' ) !== false ? '%f' : '%d'; 513 514 array_push( $placeholders, $value_type ); 515 516 } elseif ( is_array( $v_str ) ) { 517 array_push( maybe_serialize( $placeholders ), '%s' ); 935 518 } else { 936 array_push( $vals_arr, '%s' ); 937 } 938 array_push( $values_arr, $v_str ); 939 } 940 941 $fields_str = join( ',', $keys ); 942 $vals_str = join( ',', $vals_arr ); 943 //if( count( $values_arr ) > 0 ){ 944 $query = $wpdb->prepare( 'INSERT INTO `' . $table . '` ( ' . $fields_str . ' ) VALUES ( ' . $vals_str . ' );' , $values_arr ); 945 //} else { 946 //$query_str = 'INSERT INTO `' . $table . '` ( ' . $fields_str . ' ) VALUES ( ' . $vals_str . ' );'; 947 //} 948 949 if( $show_bln ){ 950 echo $query ; 951 } 952 $done = $wpdb->query( $query ); 953 if( $done ){ 519 array_push( $placeholders, '%s' ); 520 } 521 array_push( $values_arr, $v_str ); 522 } 523 524 $fields_sql = join( ',', $keys ); 525 $vals_str = join( ',', $placeholders ); 526 527 $query = $wpdb->prepare( 528 'INSERT INTO `%s` ( 529 pandarf_parent_pod_id, 530 pandarf_parent_post_id, 531 pandarf_pod_field_id, 532 pandarf_created, 533 pandarf_modified, 534 pandarf_modified_author, 535 pandarf_author, 536 pandarf_order 537 ) VALUES ( 538 %d, 539 %d, 540 %d, 541 %s, 542 %s, 543 %d, 544 %d, 545 %d 546 )', 547 array( 548 $table, 549 $attrs['parent_pod_id'], 550 $attrs['parent_pod_post_id'], 551 $attrs['parent_pod_field_id'], 552 $now, 553 $now, 554 $attrs['user_id'], 555 $attrs['user_id'], 556 $order_int, 557 ) 558 ); 559 560 if ( $show_query ) { 561 echo esc_html( $query ); 562 } 563 $done = $wpdb->query( 564 // phpcs:ignore 565 $query 566 ); // db call ok. no-cache ok. 567 if ( $done ) { 954 568 $insert_id = $wpdb->insert_id; 955 // remove prefix to keep the pod table name569 // remove prefix to keep the pod table name. 956 570 $table = ltrim( $table, $wpdb->prefix . 'pods_' ); 957 $pod = pods( $table, $insert_id ); 958 959 $pod->save( $fields ); 960 return $insert_id; 961 } 962 return false; 963 } 964 /** 965 * backward compatibility 966 */ 967 function pandarf_insert_fn( $fields = array(), $attrs = array(), $show_bln = false ){ 968 return pandarf_insert( $fields, $attrs, $show_bln ); 969 } 970 /** 971 * pandarf_pods_field filter for pods_field 972 * 973 * @param string $value_ukn value of the field 974 * @param array $row_arr 975 * @param array $params_arr 976 * @param object $pods_obj 977 * @return string|number|array 978 */ 979 add_filter( 'pods_pods_field', 'pandarf_pods_field', 10, 4 ); 980 981 function pandarf_pods_field( $value, $rows, $params, $pods ){ 571 $pod = pods( $table, $insert_id ); 572 573 $pod->save( $fields ); 574 return $insert_id; 575 } 576 return false; 577 } 578 /** 579 * Backward compatibility 580 * 581 * @param array $fields extra fields other than panda repeater fields to insert array( 'field_name' => '', 'field_name' => '' ... ). 582 * @param array $attrs search repeater field table. See $defaults in the function. 583 * @param boolean $show_query Fo developers to debug. 584 * 585 * @return boolean $done; 586 */ 587 function pandarf_insert_fn( $fields = array(), $attrs = array(), $show_query = false ) { 588 return pandarf_insert( $fields, $attrs, $show_query ); 589 } 590 591 add_filter( 'pods_pods_field', 'pandarf_pods_field', 10, 4 ); 592 /** 593 * Filter for pods_field 594 * 595 * @param string $value value of the field. 596 * @param array $rows from Pods. 597 * @param array $params from Pods. 598 * @param object $pods from Pods. 599 * 600 * @return string|number|array 601 */ 602 function pandarf_pods_field( $value, $rows, $params, $pods ) { 982 603 global $wpdb; 983 604 984 $repeaters = is_pandarf( $params->name, $pods->pod_id ); 985 //echo $pods_obj->id() . ' ' . $pods_obj->id; 986 if( $repeaters ){ 987 $saved_table = $pods->fields[ $params->name ]['options']['pandarepeaterfield_table']; 988 $items_arr = array(); 989 $child_pods = explode( '_', $saved_table ); 990 if( count( $child_pods ) == 2 && $child_pods[0] == 'pod' && is_numeric( $child_pods[1] ) ){ 991 // find the repeater table pod name 992 $query = $wpdb->prepare( 'SELECT `post_name` FROM `' . $wpdb->posts . '` WHERE `ID` = %d LIMIT 0, 1', array( $child_pods[ 1 ] ) ) ; 993 994 $items = $wpdb->get_results( $query, ARRAY_A ); 605 $repeaters = is_pandarf( $params->name, $pods->pod_id ); 606 607 if ( $repeaters ) { 608 $saved_table = $pods->fields[ $params->name ]['options']['pandarepeaterfield_table']; 609 $items_arr = array(); 610 $child_pods = explode( '_', $saved_table ); 611 if ( 2 === count( $child_pods ) && 'pod' === $child_pods[0] && is_numeric( $child_pods[1] ) ) { 612 // Find the repeater table pod name. 613 $query = $wpdb->prepare( 'SELECT `post_name` FROM `' . $wpdb->posts . '` WHERE `ID` = %d LIMIT 0, 1', array( $child_pods[1] ) ); 614 615 $items = $wpdb->get_results( 616 // phpcs:ignore 617 $query, 618 ARRAY_A 619 ); // db call ok. no-cache ok. 995 620 } else { 996 $query = $wpdb->prepare( 'SELECT `ID`, `post_name` FROM `' . $wpdb->posts . '` WHERE `post_name` = "%s" AND `post_type` = "_pods_pod" LIMIT 0, 1', array( $saved_table ) ) ; 997 998 $items = $wpdb->get_results( $query, ARRAY_A ); 999 1000 } 1001 1002 if( count( $items ) == 1 ){ 1003 1004 1005 $attrs = apply_filters( 'pandarf_pods_field_attrs', array(), $value, $rows, $params, $pods ); 1006 $fields = array( 1007 'child_pod_name' => $items[0]['post_name'] , 1008 'parent_pod_id' => $repeaters['post_parent'], 1009 'parent_pod_post_id' => $pods->id(), 1010 'parent_pod_field_id' => $repeaters['ID'] 1011 ); 1012 $fields = apply_filters( 'pandarf_pods_field_fields', $fields, $value, $rows, $params, $pods ); 1013 $data = get_pandarf_items( 1014 $fields , 1015 $attrs, 1016 0 1017 ); 1018 // check if it is a repeater field, if yes, return data 1019 $data = pandarf_get_data( $data, $items[0]['post_name'] ); 1020 1021 return $data; 1022 } 1023 1024 1025 } 1026 return $value; 1027 } 1028 /** 1029 * check if it is a repeater field, if yes, return data 1030 * @param array $data_arr data from the table row e.g. Array 1031 ( 1032 [0] => Array 1033 ( 1034 [id] => 26 1035 [name] => hi 1036 [repeater] => 1037 ) 1038 ) 1039 * @param string $parent_pod_name parent pod's name 1040 */ 1041 function pandarf_get_data( $data_arr, $parent_pod_name ){ 621 $query = $wpdb->prepare( 'SELECT `ID`, `post_name` FROM `' . $wpdb->posts . '` WHERE `post_name` = %s AND `post_type` = "_pods_pod" LIMIT 0, 1', array( $saved_table ) ); 622 623 $items = $wpdb->get_results( 624 // phpcs:ignore 625 $query, 626 ARRAY_A 627 ); // db call ok. no-cache ok. 628 629 } 630 631 if ( ! empty( $items ) ) { 632 633 $attrs = apply_filters( 'pandarf_pods_field_attrs', array(), $value, $rows, $params, $pods ); 634 $fields = array( 635 'child_pod_name' => $items[0]['post_name'], 636 'parent_pod_id' => $repeaters['post_parent'], 637 'parent_pod_post_id' => $pods->id(), 638 'parent_pod_field_id' => $repeaters['ID'], 639 ); 640 $fields = apply_filters( 'pandarf_pods_field_fields', $fields, $value, $rows, $params, $pods ); 641 $data = get_pandarf_items( 642 $fields, 643 $attrs, 644 false 645 ); 646 // Check if it is a repeater field, if yes, return data. 647 $data = pandarf_get_data( $data, $items[0]['post_name'] ); 648 649 return $data; 650 } 651 } 652 return $value; 653 } 654 /** 655 * Check if it is a repeater field, if yes, return data 656 * 657 * @param array $data_arr data from the table row e.g. Array ( [0] => Array ( [id] => 26, [name] => hi, [repeater] => '' ) ). 658 * @param string $parent_pod_name parent pod's name. 659 */ 660 function pandarf_get_data( $data_arr, $parent_pod_name ) { 1042 661 global $wpdb; 1043 1044 $pods_obj = pods( $parent_pod_name ) ;662 663 $pods_obj = pods( $parent_pod_name ); 1045 664 1046 665 $pprf_data = array(); 1047 if ( is_array( $data_arr ) && count( $data_arr ) > 0 ){1048 foreach ( $data_arr[0] as $k_str => $v_ukn ){1049 $repeaters = is_pandarf( $k_str, $pods_obj->pod_id );1050 if ( $repeaters ) {666 if ( is_array( $data_arr ) && count( $data_arr ) > 0 ) { 667 foreach ( $data_arr[0] as $k_str => $v_ukn ) { 668 $repeaters = is_pandarf( $k_str, $pods_obj->pod_id ); 669 if ( $repeaters ) { 1051 670 $pprf_data[ $k_str ] = $repeaters; 1052 671 } 1053 672 } 1054 } 1055 1056 if( count( $pprf_data ) > 0 ){ 1057 1058 // go through each repeater field and attach data 1059 foreach( $pprf_data as $k_str => $v_ukn ){ 1060 if( $pods_obj && isset( $pods_obj->fields[ $k_str ]['options']['pandarepeaterfield_table'] )){ 1061 $saved_table = $pods_obj->fields[ $k_str ]['options']['pandarepeaterfield_table']; 1062 $items_arr = array(); 1063 $child_pods = explode( '_', $saved_table ); 1064 // if saved as pod_num, version < 1.2.0 1065 if( count( $child_pods ) == 2 && $child_pods[0] == 'pod' && is_numeric( $child_pods[1] ) ){ 1066 // find the repeater table pod name 1067 $query = $wpdb->prepare( 'SELECT `post_name` FROM `' . $wpdb->posts . '` WHERE `ID` = %d LIMIT 0, 1', array( $child_pods[ 1 ] ) ) ; 1068 1069 $items_arr = $wpdb->get_results( $query, ARRAY_A ); 673 } 674 675 if ( count( $pprf_data ) > 0 ) { 676 677 // Go through each repeater field and attach data. 678 foreach ( $pprf_data as $k_str => $v_ukn ) { 679 if ( $pods_obj && isset( $pods_obj->fields[ $k_str ]['options']['pandarepeaterfield_table'] ) ) { 680 $saved_table = $pods_obj->fields[ $k_str ]['options']['pandarepeaterfield_table']; 681 $items_arr = array(); 682 $child_pods = explode( '_', $saved_table ); 683 // If saved as pod_num, version < 1.2.0. 684 if ( 2 === count( $child_pods ) && 'pod' === $child_pods[0] && is_numeric( $child_pods[1] ) ) { 685 // Find the repeater table pod name. 686 $query = $wpdb->prepare( 'SELECT `post_name` FROM `' . $wpdb->posts . '` WHERE `ID` = %d LIMIT 0, 1', array( $child_pods[1] ) ); 687 688 $items_arr = $wpdb->get_results( 689 // phpcs:ignore 690 $query, 691 ARRAY_A 692 ); // db call ok. no-cache ok. 1070 693 } else { 1071 $query = $wpdb->prepare( 'SELECT `ID`, `post_name` FROM `' . $wpdb->posts . '` WHERE `post_name` = "%s" AND `post_type` = "_pods_pod" LIMIT 0, 1', array( $saved_table ) ) ; 1072 1073 $items_arr = $wpdb->get_results( $query, ARRAY_A ); 1074 1075 } 1076 if( count( $items_arr ) == 1 ){ 1077 for( $i = 0; $i < count( $data_arr ); $i ++ ){ 1078 $attrs = apply_filters( 'pandarf_data_attrs', array(), $data_arr, $parent_pod_name ); 1079 $fields = array( 1080 'child_pod_name' => $items_arr[0]['post_name'] , 1081 'parent_pod_id' => $pprf_data[ $k_str ]['post_parent'], 1082 'parent_pod_post_id' => $data_arr[ $i ]['id'], 1083 'parent_pod_field_id' => $pprf_data[ $k_str ]['ID'] 1084 ) ; 1085 $child_data = get_pandarf_items( 1086 $fields, 1087 $attrs, 1088 0 1089 ); 1090 1091 // check if it is a repeater field, if yes, return data 1092 $child_data = pandarf_get_data( $child_data, $items_arr[0]['post_name'] ); 1093 1094 $data_arr[ $i ][ $k_str ] = $child_data; 1095 694 $query = $wpdb->prepare( 'SELECT `ID`, `post_name` FROM `' . $wpdb->posts . '` WHERE `post_name` = %s AND `post_type` = "_pods_pod" LIMIT 0, 1', array( $saved_table ) ); 695 696 $items_arr = $wpdb->get_results( 697 // phpcs:ignore 698 $query, 699 ARRAY_A 700 ); // db call ok. no-cache ok. 701 702 } 703 if ( ! empty( $items_arr ) ) { 704 $data_count = count( $data_arr ); 705 for ( $i = 0; $i < $data_count; $i ++ ) { 706 $attrs = apply_filters( 'pandarf_data_attrs', array(), $data_arr, $parent_pod_name ); 707 $fields = array( 708 'child_pod_name' => $items_arr[0]['post_name'], 709 'parent_pod_id' => $pprf_data[ $k_str ]['post_parent'], 710 'parent_pod_post_id' => $data_arr[ $i ]['id'], 711 'parent_pod_field_id' => $pprf_data[ $k_str ]['ID'], 712 ); 713 $child_data = get_pandarf_items( 714 $fields, 715 $attrs, 716 false 717 ); 718 719 // Check if it is a repeater field, if yes, return data. 720 $child_data = pandarf_get_data( $child_data, $items_arr[0]['post_name'] ); 721 722 $data_arr[ $i ][ $k_str ] = $child_data; 723 1096 724 } 1097 725 } 1098 1099 726 } 1100 727 } … … 1103 730 } 1104 731 /** 1105 * Is a panda pods repeater field? 1106 * @param string $field_name pods field name 1107 * @param integer $parent_id parent post id 1108 * 732 * Is it a panda pods repeater field? 733 * 734 * @param string $field_name pods field name. 735 * @param integer $parent_id parent post id. 736 * 1109 737 * @return false|array $pandarf_field; 1110 738 */ 1111 function is_pandarf( $field_name, $parent_id = 0 ) {739 function is_pandarf( $field_name, $parent_id = 0 ) { 1112 740 global $wpdb; 1113 741 1114 $field_name = esc_sql( $field_name );1115 $parent_id = intval( $parent_id );1116 $key = $field_name . '_' . $parent_id;1117 $pandarf_field = wp_cache_get( $key, 'pandarf_fields' );1118 742 $field_name = esc_sql( $field_name ); 743 $parent_id = intval( $parent_id ); 744 $key = $field_name . '_' . $parent_id; 745 $pandarf_field = wp_cache_get( $key, 'pandarf_fields' ); 746 1119 747 if ( false === $pandarf_field ) { 1120 1121 $params =array( $field_name );1122 $where ='';1123 if ( is_numeric( $parent_id ) && $parent_id != 0 ){1124 $where =' AND ps_tb.`post_parent` = %d';748 749 $params = array( $field_name ); 750 $where = ''; 751 if ( is_numeric( $parent_id ) && 0 !== $parent_id ) { 752 $where = ' AND ps_tb.`post_parent` = %d'; 1125 753 array_push( $params, $parent_id ); 1126 754 } 1127 1128 $query = $wpdb->prepare( 'SELECT ps_tb.ID, ps_tb.post_name, ps_tb.post_title, ps_tb.post_author, ps_tb.post_parent1129 1130 FROM `' . $wpdb->posts . '` AS ps_tb1131 1132 INNER JOIN `' . $wpdb->postmeta . '` AS pm_tb ON ps_tb.`ID` = pm_tb.`post_id` AND pm_tb.`meta_key` = "type" AND pm_tb.`meta_value` = "pandarepeaterfield"1133 WHERE ps_tb.`post_type` = "_pods_field" AND ps_tb.`post_name` = "%s" ' . $where . ' LIMIT 0, 1' , $params ); 1134 //if( 'simpods_normal_contents' == $field_name ){1135 // echo $query_str;1136 //}1137 1138 $items = $wpdb->get_results( $query, ARRAY_A );1139 $pandarf_field = 0; // use 0 so it won't conflict with wp_cache_get() when it returns false.1140 if ( ! empty( $items ) ){1141 755 756 $query = $wpdb->prepare( 757 // phpcs:ignore 758 'SELECT ps_tb.ID, ps_tb.post_name, ps_tb.post_title, ps_tb.post_author, ps_tb.post_parent FROM `' . $wpdb->posts . '` AS ps_tb INNER JOIN `' . $wpdb->postmeta . '` AS pm_tb ON ps_tb.`ID` = pm_tb.`post_id` AND pm_tb.`meta_key` = "type" AND pm_tb.`meta_value` = "pandarepeaterfield" WHERE ps_tb.`post_type` = "_pods_field" AND ps_tb.`post_name` = %s ' . $where . ' LIMIT 0, 1', 759 $params 760 ); 761 762 $items = $wpdb->get_results( 763 // phpcs:ignore 764 $query, 765 ARRAY_A 766 ); // db call ok. no-cache ok. 767 $pandarf_field = 0; // use 0 so it won't conflict with wp_cache_get() when it returns false. 768 if ( ! empty( $items ) ) { 769 1142 770 $pandarf_field = $items[0]; 1143 } 1144 771 } 772 1145 773 wp_cache_set( $key, $pandarf_field, 'pandarf_fields' ); 1146 } 774 } 1147 775 return $pandarf_field; 1148 1149 } 1150 /** 1151 * backward compatibility 1152 */ 1153 function is_pandarf_fn( $field_name, $parent_id = 0 ){ 776 777 } 778 /** 779 * Backward compatibility 780 * 781 * @param string $field_name Pods field name. 782 * @param integer $parent_id Parent post id. 783 * 784 * @return false|array $pandarf_field; 785 */ 786 function is_pandarf_fn( $field_name, $parent_id = 0 ) { 1154 787 return is_pandarf( $field_name, $parent_id ); 1155 788 } 1156 789 1157 if ( !is_admin() ){790 if ( ! is_admin() ) { 1158 791 add_action( 'after_setup_theme', 'load_pprf_frontend_scripts' ); 1159 792 /** 1160 * load the PPRF scripts and style1161 */ 1162 function load_pprf_frontend_scripts() {793 * Load the PPRF scripts and style. 794 */ 795 function load_pprf_frontend_scripts() { 1163 796 $can_load_pprf_scripts = true; 1164 $can_load_pprf_scripts = apply_filters( 'load_pprf_scripts_frontend', $can_load_pprf_scripts ); 1165 if ( true == $can_load_pprf_scripts ){1166 add_action( 'wp_enqueue_scripts', 'pprf_enqueue_scripts' ) ;1167 } 1168 } 1169 } 1170 //add_action( 'wp_enqueue_scripts', 'pprf_enqueue_scripts' ) ; 797 $can_load_pprf_scripts = apply_filters( 'load_pprf_scripts_frontend', $can_load_pprf_scripts ); 798 if ( true === $can_load_pprf_scripts ) { 799 add_action( 'wp_enqueue_scripts', 'pprf_enqueue_scripts' ); 800 } 801 } 802 } 803 1171 804 /** 1172 805 * Enqueue front-end scripts … … 1178 811 function pprf_enqueue_scripts() { 1179 812 global $pprf_l10n, $wp_version; 1180 /** 1181 * All styles goes here 1182 */ 1183 wp_register_style( 'panda-pods-repeater-general-styles', plugins_url( 'css/general.min.css', __FILE__ ) ); 1184 wp_enqueue_style( 'panda-pods-repeater-general-styles' ); 1185 wp_register_style( 'panda-pods-repeater-styles', plugins_url( 'css/front-end.min.css', __FILE__ ), array('panda-pods-repeater-general-styles'), 1.2 ); 1186 wp_enqueue_style( 'panda-pods-repeater-styles'); 1187 1188 if( isset( $_GET ) && isset( $_GET['page'] ) && $_GET['page'] == 'panda-pods-repeater-field' ){ 1189 wp_enqueue_style( 'dashicons' ); 1190 wp_register_style('pprf_fields', plugins_url( 'fields/css/pprf.min.css', __FILE__ ), array( 'panda-pods-repeater-general-styles', 'panda-pods-repeater-styles') ); 1191 wp_enqueue_style('pprf_fields'); 1192 } 1193 /** 1194 * All scripts goes here 1195 */ 813 814 // All styles goes here. 815 wp_register_style( 'panda-pods-repeater-general-styles', plugins_url( 'css/general.min.css', __FILE__ ), array(), '1.0.0' ); 816 wp_enqueue_style( 'panda-pods-repeater-general-styles' ); 817 wp_register_style( 'panda-pods-repeater-styles', plugins_url( 'css/front-end.min.css', __FILE__ ), array( 'panda-pods-repeater-general-styles' ), '1.2.0' ); 818 wp_enqueue_style( 'panda-pods-repeater-styles' ); 819 820 if ( isset( $_GET ) && isset( $_GET['page'] ) && isset( $_GET['pprf_nonce'] ) ) { 821 $page = sanitize_title( wp_unslash( $_GET['page'] ) ); 822 $pprf_nonce = sanitize_text_field( wp_unslash( $_GET['pprf_nonce'] ) ); 823 if ( wp_verify_nonce( $pprf_nonce, 'load-pprf-page' ) ) { 824 if ( 'panda-pods-repeater-field' === $_GET['page'] ) { 825 wp_enqueue_style( 'dashicons' ); 826 wp_register_style( 'pprf_fields', plugins_url( 'fields/css/pprf.min.css', __FILE__ ), array( 'panda-pods-repeater-general-styles', 'panda-pods-repeater-styles' ), '1.0.0' ); 827 wp_enqueue_style( 'pprf_fields' ); 828 } 829 } 830 } 831 832 // All scripts goes here. 1196 833 if ( version_compare( $wp_version, '5.9', '=' ) ) { 1197 wp_register_script( 'panda-pods-repeater-jquery-ui', plugins_url( 'library/js/jquery-ui.min.js', __FILE__ ), array( 'jquery' ), false, true ); 1198 wp_register_script( 'panda-pods-repeater-scripts', plugins_url( 'js/admin.min.js', __FILE__ ), array( 'jquery', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'panda-pods-repeater-jquery-ui' ), false, true ); 834 wp_register_script( 'panda-pods-repeater-scripts', plugins_url( 'js/admin.min.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'panda-pods-repeater-jquery-ui' ), '1.0.0', true ); 1199 835 } else { 1200 wp_register_script( 'panda-pods-repeater-scripts', plugins_url( 'js/admin.min.js', __FILE__ ), array( 'jquery', 'jquery-ui- resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable' ), false, true );836 wp_register_script( 'panda-pods-repeater-scripts', plugins_url( 'js/admin.min.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable' ), '1.0.0', true ); 1201 837 } 1202 838 1203 839 wp_enqueue_script( 'panda-pods-repeater-scripts' ); 1204 // translation1205 wp_localize_script( 1206 'panda-pods-repeater-scripts', 1207 'strs_obj', 840 // Translation. 841 wp_localize_script( 842 'panda-pods-repeater-scripts', 843 'strs_obj', 1208 844 $pprf_l10n 1209 845 ); 1210 846 1211 // prepare ajax1212 wp_localize_script( 1213 'panda-pods-repeater-scripts', 1214 'ajax_script', 847 // Prepare ajax. 848 wp_localize_script( 849 'panda-pods-repeater-scripts', 850 'ajax_script', 1215 851 array( 1216 'ajaxurl' => admin_url( 'admin-ajax.php' ),1217 'nonce'=> wp_create_nonce( 'panda-pods-repeater-field-nonce' ),852 'ajaxurl' => admin_url( 'admin-ajax.php' ), 853 'nonce' => wp_create_nonce( 'panda-pods-repeater-field-nonce' ), 1218 854 ) 1219 ); 1220 //$admin_url = substr( admin_url(), 0, strrpos( admin_url(), '/wp-admin/' ) + 10 ); 1221 //$admin_url = PANDA_PODS_REPEATER_URL . 'fields/pandarepeaterfield.php'; 1222 $admin_url = PANDA_PODS_REPEATER_URL . 'fields/'; // since 1.4.9, we have index.php to avoid being stopped by <FilesMatch "\.(?i:php)$"> 1223 wp_localize_script( 1224 'panda-pods-repeater-scripts', 1225 'PANDA_PODS_REPEATER_PAGE_URL', 855 ); 856 857 $admin_url = PANDA_PODS_REPEATER_URL . 'fields/'; // since 1.4.9, we have index.php to avoid being stopped by <FilesMatch "\.(?i:php)$">. 858 wp_localize_script( 859 'panda-pods-repeater-scripts', 860 'PANDA_PODS_REPEATER_PAGE_URL', 1226 861 array( $admin_url . '?page=panda-pods-repeater-field&' ) 1227 ); 1228 wp_localize_script( 1229 'panda-pods-repeater-scripts', 1230 'PANDA_PODS_REPEATER_URL', 862 ); 863 wp_localize_script( 864 'panda-pods-repeater-scripts', 865 'PANDA_PODS_REPEATER_URL', 1231 866 array( PANDA_PODS_REPEATER_URL ) 1232 ); 1233 1234 /** 1235 * Example for setting up text strings from Javascript files for localization 1236 * 1237 * Uncomment line below and replace with proper localization variables. 1238 */ 1239 // $translation_array = array( 'some_string' => __( 'Some string to translate', 'panda-pods-repeater-field' ), 'a_value' => '10' ); 1240 // wp_localize_script( 'panda-pods-repeater-scripts', 'podsExtend', $translation_array ) ); 1241 1242 } 1243 1244 1245 /** 1246 * check pod type 1247 */ 1248 1249 function pprf_pod_details( $pod_int ){ 1250 global $wpdb; 1251 $query_str = $wpdb->prepare( 1252 'SELECT *, pm_tb.`meta_value` AS type FROM `' . $wpdb->prefix . 'posts` AS ps_tb 867 ); 868 869 } 870 871 872 /** 873 * Check pod type 874 * 875 * @param int $pod_id Pod id. 876 */ 877 function pprf_pod_details( $pod_id ) { 878 global $wpdb; 879 $query = $wpdb->prepare( 880 'SELECT *, pm_tb.`meta_value` AS type FROM `' . $wpdb->prefix . 'posts` AS ps_tb 1253 881 INNER JOIN `' . $wpdb->prefix . 'postmeta` AS pm_tb ON ps_tb.`ID` = pm_tb.`post_id` AND pm_tb.`meta_key` = "type" 1254 WHERE `ID` = %d LIMIT 0, 1 ', array( $pod_int ) 1255 ); 1256 1257 $parent_details = $wpdb->get_results( $query_str, ARRAY_A ); 1258 if( $parent_details ){ 1259 $parent_details = $parent_details[0]; 882 WHERE `ID` = %d LIMIT 0, 1 ', 883 array( $pod_id ) 884 ); 885 886 $parent_details = $wpdb->get_results( 887 // phpcs:ignore 888 $query, 889 ARRAY_A 890 ); // db call ok. no-cache ok. 891 if ( ! empty( $parent_details ) ) { 892 $parent_details = $parent_details[0]; 1260 893 } 1261 894 return $parent_details; 1262 895 } 1263 896 /** 1264 * backward compatibility 1265 */ 1266 function pprf_pod_details_fn( $pod_int ){ 1267 return pprf_pod_details( $pod_int ); 1268 } 1269 /*function pprf_family_tree_fn( $attrs ){ 1270 1271 global $wpdb; 1272 1273 $defaults = array( 1274 'parent_pod_id' => '', 1275 'parent_pod_post_id' => '', 1276 'parent_pod_field_id' => '', 1277 ); 1278 1279 $attrs = wp_parse_args( $attrs, $defaults ); 1280 }*/ 1281 /** 1282 * get the repeater fields using the same same table in the pod 1283 * 1284 * @param string $pod_cla a pod, generated by pods( pod_slug ); 1285 * @param string $ctb_str the table pod slug for the repeater field 1286 * @return array the repeater fields using the same same table in the pod 1287 */ 1288 function pprf_same_child_tb_fields( $pod_cla, $ctb_str = '' ){ 1289 1290 $return_data = array(); 1291 1292 foreach( $pod_cla->fields as $ck_str => $cField_arr ){ 1293 if( $cField_arr['type'] == 'pandarepeaterfield' && $ctb_str == $cField_arr['options']['pandarepeaterfield_table'] ){ 1294 $return_data[ $ck_str ] = $cField_arr; 1295 } 1296 } 897 * Backward compatibility. 898 * 899 * @param int $pod_id Pod id. 900 */ 901 function pprf_pod_details_fn( $pod_id ) { 902 return pprf_pod_details( $pod_id ); 903 } 904 905 /** 906 * Get the repeater fields using the same same table in the pod 907 * 908 * @param string $pod A pod, generated by pods( pod_slug ). 909 * @param string $child_table The table pod slug for the repeater field. 910 * 911 * @return array $return_data The repeater fields using the same same table in the pod. 912 */ 913 function pprf_same_child_tb_fields( $pod, $child_table = '' ) { 914 915 $return_data = array(); 916 917 foreach ( $pod->fields as $key => $child_field ) { 918 if ( 'pandarepeaterfield' === $child_field['type'] && $child_table === $child_field['options']['pandarepeaterfield_table'] ) { 919 $return_data[ $key ] = $child_field; 920 } 921 } 1297 922 1298 923 return $return_data; 1299 924 } 1300 // load language 925 1301 926 add_action( 'plugins_loaded', 'pprf_localization_setup' ); 927 /** 928 * Load language 929 */ 1302 930 function pprf_localization_setup() { 1303 load_plugin_textdomain( 'panda-pods-repeater-field', false, basename( dirname( __FILE__ ) ) . '/languages' ); 1304 } 1305 /** 1306 * load the tables that been updated with pprf columns. 931 load_plugin_textdomain( 'panda-pods-repeater-field', false, basename( dirname( __FILE__ ) ) . '/languages' ); 932 } 933 /** 934 * Load the tables that been updated with pprf columns. 935 * 1307 936 * @since 1.4.5 1308 * @param $table string the table name to search. If empty, return the saved record for the updated tables. 1309 * @param $operate string Works if $table is not empty. If $operate is empty, return ture or false respectively if the table is found or not. Return null. 1310 * @param $operate string Works if $table is not empty. If $operate = 'add', add the table to the record. Return null. 1311 * @param $operate string Works if $table is not empty. If $operate = 'remove', remove the table from the record. Return null. 937 * @param string $table the table name to search. If empty, return the saved record for the updated tables. 938 * @param string $operate Works if $table is not empty. If $operate is empty, return ture or false respectively. If the table is found or not, return null. If $operate = 'add', add the table to the record. If $operate = 'remove', remove the table from the record. 1312 939 * @return array|boolean|null See the descriptions of the parameters above. 1313 940 */ 1314 function pprf_updated_tables( $table = '', $operate = '' ) {1315 $updated_tables = get_option( 'pprf_updated_tables', array() );1316 1317 if ( ! is_array( $updated_tables ) ){941 function pprf_updated_tables( $table = '', $operate = '' ) { 942 $updated_tables = get_option( 'pprf_updated_tables', array() ); 943 944 if ( ! is_array( $updated_tables ) ) { 1318 945 $updated_tables = array(); 1319 946 } 1320 947 1321 if ( $table == '' ){948 if ( '' === $table ) { 1322 949 return $updated_tables; 1323 950 } else { 1324 if ( isset( $updated_tables[ $table ] ) ){1325 if ( '' == $operate ){951 if ( isset( $updated_tables[ $table ] ) ) { 952 if ( '' === $operate ) { 1326 953 return true; 1327 954 } 1328 if ( 'remove' == $operate ){955 if ( 'remove' === $operate ) { 1329 956 unset( $updated_tables[ $table ] ); 1330 957 return update_option( 'pprf_updated_tables', $updated_tables ); 1331 1332 } 1333 958 959 } 1334 960 } else { 1335 if ( 'add' == $operate ){1336 $updated_tables[ $table ] = array();// set it as an array for futurn use 961 if ( 'add' === $operate ) { 962 $updated_tables[ $table ] = array();// set it as an array for futurn use. 1337 963 return update_option( 'pprf_updated_tables', $updated_tables ); 1338 964 1339 965 } 1340 966 return false; 1341 967 } 1342 1343 968 } 1344 969 … … 1347 972 /** 1348 973 * Check if a string contains images, videos, audio medias or relevant shortcode start with them. 974 * 1349 975 * @since 1.4.5 1350 * @param $content string the string1351 * @return return relevant icons if it contains a media.1352 */ 1353 function pprf_check_media_in_content( $content ) {976 * @param string $content The content string. 977 * @return string $html Relevant icons if it contains a media. 978 */ 979 function pprf_check_media_in_content( $content ) { 1354 980 $html = ' '; 1355 preg_match_all('/(<img .*?>|\[img.*?\]|\[image.*?\])/is', $content, $tags ); 1356 1357 if( ! empty( $tags[0] ) ){ 1358 $html .= ' <span class="dashicons dashicons-format-image" title ="' . esc_attr__( 'Contains images', 'panda-pods-repeater-field' ). '"></span>'; 1359 } 1360 preg_match_all('/(<video .*?>|\[video.*?\])/is', $content, $tags ); 1361 1362 if( ! empty( $tags[0] ) ){ 1363 $html .= ' <span class="dashicons dashicons-format-video" title ="' . esc_attr__( 'Contains videos', 'panda-pods-repeater-field' ). '"></span>'; 1364 } 1365 1366 preg_match_all('/(<audio .*?>|\[audio.*?\])/is', $content, $tags ); 1367 1368 if( ! empty( $tags[0] ) ){ 1369 $html .= ' <span class="dashicons dashicons-format-audio" title ="' . esc_attr__( 'Contains audio', 'panda-pods-repeater-field' ). '"></span>'; 1370 } 1371 preg_match_all('/(\[.*?\])/is', $content, $tags ); 1372 1373 if( ! empty( $tags[0] ) ){ 1374 $html .= ' <span class="dashicons dashicons-wordpress" title ="' . esc_attr__( 'Maybe contain shortcode', 'panda-pods-repeater-field' ). '"></span>'; 1375 } 1376 1377 return $html; 1378 } 1379 1380 /*** 1381 * parent items filter conditions for assigning child items 1382 */ 1383 function pprf_parent_filter_conditions( $parent_details = array(), $parrent_limit = 20, $page = 1 ){ 1384 $conditions = array( 1385 'limit' => $parrent_limit, 1386 'page' => (int) $page, 1387 ); 1388 //normal post type fetch all published and draft posts 1389 if( isset( $parent_details['type'] ) && $parent_details['type'] == 'post_type' ){ 1390 1391 $conditions['where'] = '( t.post_status = "publish" OR t.post_status = "draft" )'; 1392 $conditions['orderby'] = 't.post_title'; 1393 1394 } 1395 1396 $conditions = apply_filters( 'filter_pprf_parent_filter_conditions', $conditions, $parent_details ); 1397 1398 return $conditions; 1399 } 981 preg_match_all( '/(<img .*?>|\[img.*?\]|\[image.*?\])/is', $content, $tags ); 982 983 if ( ! empty( $tags[0] ) ) { 984 $html .= ' <span class="dashicons dashicons-format-image mgr5" title ="' . esc_attr__( 'Contains images', 'panda-pods-repeater-field' ) . '"></span>'; 985 } 986 preg_match_all( '/(<video .*?>|\[video.*?\])/is', $content, $tags ); 987 988 if ( ! empty( $tags[0] ) ) { 989 $html .= ' <span class="dashicons dashicons-format-video mgr5" title ="' . esc_attr__( 'Contains videos', 'panda-pods-repeater-field' ) . '"></span>'; 990 } 991 992 preg_match_all( '/(<audio .*?>|\[audio.*?\])/is', $content, $tags ); 993 994 if ( ! empty( $tags[0] ) ) { 995 $html .= ' <span class="dashicons dashicons-format-audio mgr5" title ="' . esc_attr__( 'Contains audio', 'panda-pods-repeater-field' ) . '"></span>'; 996 } 997 preg_match_all( '/(\[.*?\])/is', $content, $tags ); 998 999 if ( ! empty( $tags[0] ) ) { 1000 $html .= ' <span class="dashicons dashicons-wordpress mgr5" title ="' . esc_attr__( 'Maybe contain shortcode', 'panda-pods-repeater-field' ) . '"></span>'; 1001 } 1002 1003 return $html; 1004 } 1005 1006 /** 1007 * Parent items filter conditions for assigning child items 1008 * 1009 * @param array $parent_details Conditions to load the parent items. 1010 * @param int $parent_limit How many to parent items load. 1011 * @param int $page From which page. 1012 * 1013 * @return array $condtions Return the query conditions. 1014 */ 1015 function pprf_parent_filter_conditions( $parent_details = array(), $parent_limit = 20, $page = 1 ) { 1016 $conditions = array( 1017 'limit' => $parent_limit, 1018 'page' => (int) $page, 1019 ); 1020 // Normal post type fetch all published and draft posts. 1021 if ( isset( $parent_details['type'] ) && 'post_type' === $parent_details['type'] ) { 1022 1023 $conditions['where'] = '( t.post_status = "publish" OR t.post_status = "draft" )'; 1024 $conditions['orderby'] = 't.post_title'; 1025 1026 } 1027 1028 $conditions = apply_filters( 'filter_pprf_parent_filter_conditions', $conditions, $parent_details ); 1029 1030 return $conditions; 1031 } 1032 1033 /** 1034 * Add iFrame to allowed wp_kses_post tags 1035 * 1036 * @param array $tags Allowed tags, attributes, and/or entities. 1037 * @param string $context Context to judge allowed tags by. Allowed values are 'post'. 1038 * 1039 * @link https://gist.github.com/bjorn2404/8afe35383a29d2dd1135ae0a39dc018c 1040 * @example add_filter( 'wp_kses_allowed_html', 'pprf_custom_wpkses_post_tags', 10, 2 ); 1041 * 1042 * @return array 1043 */ 1044 function pprf_custom_wpkses_post_tags( $tags, $context ) { 1045 1046 if ( 'post' === $context ) { 1047 $tags['iframe'] = array( 1048 'src' => true, 1049 'height' => true, 1050 'width' => true, 1051 'frameborder' => true, 1052 'allowfullscreen' => true, 1053 'name' => true, 1054 'id' => true, 1055 'style' => true, 1056 'class' => true, 1057 ); 1058 $tags['input'] = array( 1059 'type' => true, 1060 'value' => true, 1061 'name' => true, 1062 'id' => true, 1063 'style' => true, 1064 'class' => true, 1065 'data-*' => true, 1066 ); 1067 } 1068 1069 return $tags; 1070 }
Note: See TracChangeset
for help on using the changeset viewer.