function er_easy_repeater_class_meta_box($object, $box) { ?> <?php wp_nonce_field(basename(__FILE__), 'reapeter_meta_id_nonce'); include plugin_dir_path(__FILE__) . 'options-functions.php'; if (file_exists(GETTEMPLATEPTHTOPLUG . '/easy-options.php')) { include GETTEMPLATEPTHTOPLUG . '/easy-options.php'; } else { include plugin_dir_path(__FILE__) . 'options.php'; } $cheack = get_post_meta($object->ID, "reapeter_meta_key", true); ?> <input type="hidden" value="false" name="reapeter_meta_key" checked="c" /> <input type="checkbox" id="reapeter_meta_key_id" class="inline-inner megacheackbox" value="true" name="reapeter_meta_key" <?php if ($cheack == "true") { echo 'checked="checked"'; } ?> /> <label for="reapeter_meta_key_id" id="toggle-check"><span></span></label> <p class="desc"><?php _e('enable or disable fields', 'easy-repeater'); ?> </p> <div class="input_fields_wrap handles exbnda ecolabs" <?php if ($cheack != "true") { echo 'style="display:none;"'; } ?> > <br /> <button class="add_field_button nomabottom"><i class="fa fa-plus"></i> <span><?php _e('Add More Fields', 'easy-repeater'); ?> </span></button><span class="loader-img"></span> <?php $dat = get_post_meta($object->ID, 'reapeter_meta_id', true); if (!empty($dat) and str_word_count($dat) > 5) { $dat = unserialize($dat); $i = 1; foreach ($dat as $key => $value) { ?> <div id="main-block<?php echo $key; ?> "> <h2 class="block-head"> <span class="move"><i class="fa fa-arrows-alt"></i></span> <b class="expand"></b> <input class="main-tile-input" type="text" value="<?php echo $value['block_main_name_top']; ?> " name="reapeter_meta_id[<?php echo $key; ?> ][block_main_name_top]" /> <a href="#" class="remove_field">X</a> </h2> <div class="options-holder" id="oh<?php echo $key; ?> "> <?php easy_repeater_create_form($options_meta, $key, $dat, 'reapeter_meta_id'); ?> </div> </div> <?php $i++; } } else { ?> <div id="main-block0"> <h2 class="block-head"> <span class="move"><i class="fa fa-arrows-alt"></i></span> <b class="expand"></b> <input class="main-tile-input" type="text" value="<?php _e('block title ...', 'easy-repeater'); ?> " name="reapeter_meta_id[0][block_main_name_top]" /> <a href="#" class="remove_field">X</a> </h2> <div class="options-holder" id="oh0"> <?php easy_repeater_create_form($options_meta, "0", "", 'reapeter_meta_id'); ?> </div> </div> <?php } ?> </div> <?php }
function easy_repeater_action_callback() { global $wpdb; include plugin_dir_path(__FILE__) . 'options-functions.php'; if (file_exists(GETTEMPLATEPTHTOPLUG . '/easy-options.php')) { include GETTEMPLATEPTHTOPLUG . '/easy-options.php'; } else { include plugin_dir_path(__FILE__) . 'options.php'; } $aa = intval($_POST['aa']); $xx = intval($_POST['xx']); $namee = $_POST['name']; $pathpath = intval($_POST['pathpath']); if ($namee == "reapeter_meta_id") { $options = $options_meta; } else { $options = $options; } ?> <div id="main-block<?php echo $xx; ?> "> <h2 class="block-head"> <span class="move"><i class="fa fa-arrows-alt"></i></span> <b class="expand"></b> <input class="main-tile-input" type="text" value="<?php _e('block title ...', 'easy-repeater'); ?> " name="<?php echo $namee; ?> [<?php echo $xx; ?> ][block_main_name_top]" /> <a href="#" class="remove_field">X</a> </h2> <div class="options-holder" id="oh<?php echo $xx; ?> "> <?php easy_repeater_create_form($options, $xx, "", $namee); ?> </div> </div> <?php wp_die(); }
function easy_repeater_options() { include plugin_dir_path(__FILE__) . 'options-functions.php'; if (file_exists(GETTEMPLATEPTHTOPLUG . '/easy-options.php')) { include GETTEMPLATEPTHTOPLUG . '/easy-options.php'; } else { include plugin_dir_path(__FILE__) . 'options.php'; } ?> <div class="wrap repeater-container"> <div class="repeater-header"> <h2><?php $main_title_name = get_option('repeat_main_name'); if (!empty($main_title_name)) { echo $main_title_name; } else { _e('Easy Repeater', 'easy-repeater'); } ?> </h2> <small><?php $main_title_des = get_option('repeat_menu_des'); if (!empty($main_title_des)) { echo $main_title_des; } else { _e('repeating fields', 'easy-repeater'); } ?> </small> </div> <form method="post" action="options.php"> <?php settings_fields('repeater-option'); ?> <?php do_settings_sections('repeater-option'); ?> <div class="input_fields_wrap handles exbnda"> <button class="add_field_button"><i class="fa fa-plus"></i> <span><?php _e('Add More Fields', 'easy-repeater'); ?> </span></button><span class="loader-img"></span> <?php $dat = get_option('repeat_main_array_save'); if (!empty($dat) and str_word_count($dat) > 5) { $dat = unserialize($dat); $i = 1; /* if you want check array :D echo "<pre>"; print_r($dat); echo "</pre>"; */ foreach ($dat as $key => $value) { ?> <div id="main-block<?php echo $key; ?> "> <h2 class="block-head"> <span class="move"><i class="fa fa-arrows-alt"></i></span> <b class="expand"></b> <input class="main-tile-input" type="text" value="<?php echo $value['block_main_name_top']; ?> " name="repeat_main_array_save[<?php echo $key; ?> ][block_main_name_top]" /> <a href="#" class="remove_field">X</a> </h2> <div class="options-holder" id="oh<?php echo $key; ?> "> <?php easy_repeater_create_form($options, $key, $dat, 'repeat_main_array_save'); ?> </div> </div> <?php $i++; } } else { update_option('repeat_main_array_save', ""); ?> <div id="main-block0"> <h2 class="block-head"> <span class="move"><i class="fa fa-arrows-alt"></i></span> <b class="expand"></b> <input class="main-tile-input" type="text" value="<?php _e('block title ...', 'easy-repeater'); ?> " name="repeat_main_array_save[0][block_main_name_top]" /> <a href="#" class="remove_field">X</a> </h2> <div class="options-holder" id="oh0"> <?php easy_repeater_create_form($options, "0", "", 'repeat_main_array_save'); ?> </div> </div> <?php } ?> </div> <button type="submit" name="submit" id="submit" class="save_field_button"><i class="fa fa-save"></i> <span><?php _e('Save Changes', 'easy-repeater'); ?> </span></button> </form> <?php echo easy_repeater_footer(); ?> </div> <?php }