public function display() { $rows_data = $this->model->get_rows_data(); $page_nav = $this->model->page_nav(); $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : ''; $search_select_value = isset($_POST['search_select_value']) ? (int) $_POST['search_select_value'] : 0; $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'asc'; $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'id'; $order_class = 'manage-column column-title sorted ' . $asc_or_desc; $ids_string = ''; ?> <div style="clear: both; float: left; width: 99%;"> <div style="float: left; font-size: 14px; font-weight: bold;"> This section allows you to create, edit and delete sliders. <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-slider-wd-guide-step-2.html">Read More in User Manual</a> </div> <div style="float: right; text-align: right;"> <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromslider.php"> <img width="215" border="0" alt="web-dorado.com" src="<?php echo WD_S_URL . '/images/wd_logo.png'; ?> " /> </a> </div> </div> <form class="wrap" id="sliders_form" method="post" action="admin.php?page=sliders_wds" style="float: left; width: 99%;"> <?php wp_nonce_field('nonce_wd', 'nonce_wd'); ?> <span class="slider-icon"></span> <h2> Sliders <a href="" class="add-new-h2" onclick="spider_set_input_value('task', 'add'); spider_form_submit(event, 'sliders_form')">Add new</a> </h2> <div class="buttons_div"> <span class="button-secondary non_selectable" onclick="spider_check_all_items()"> <input type="checkbox" id="check_all_items" name="check_all_items" onclick="spider_check_all_items_checkbox()" style="margin: 0; vertical-align: middle;" /> <span style="vertical-align: middle;">Select All</span> </span> <input class="button-secondary" type="submit" onclick="spider_set_input_value('task', 'publish_all')" value="Publish" /> <input class="button-secondary" type="submit" onclick="spider_set_input_value('task', 'unpublish_all')" value="Unpublish" /> <input class="button-secondary" type="submit" onclick="spider_set_input_value('task', 'duplicate_all')" value="Duplicate" /> <input type="button" class="button-secondary wds_free_button" onclick="alert('This functionality is disabled in free version.')" value="Export" /> <input type="button" class="button-secondary wds_free_button" onclick="alert('This functionality is disabled in free version.')" value="Import" /> <input class="button-secondary" type="submit" onclick="if (confirm('Do you want to delete selected items?')) { spider_set_input_value('task', 'delete_all'); } else { return false; }" value="Delete" /> </div> <div class="tablenav top"> <?php WDW_S_Library::search('Name', $search_value, 'sliders_form'); WDW_S_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'sliders_form'); ?> </div> <table class="wp-list-table widefat fixed pages"> <thead> <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" onclick="spider_check_all(this)" style="margin:0;" /></th> <th class="table_small_col <?php if ($order_by == 'id') { echo $order_class; } ?> "> <a onclick="spider_set_input_value('task', ''); spider_set_input_value('order_by', 'id'); spider_set_input_value('asc_or_desc', '<?php echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'id' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc'; ?> '); spider_form_submit(event, 'sliders_form')" href=""> <span>ID</span><span class="sorting-indicator"></span> </a> </th> <th class="table_big_col">Slider</th> <th class="<?php if ($order_by == 'name') { echo $order_class; } ?> "> <a onclick="spider_set_input_value('task', ''); spider_set_input_value('order_by', 'name'); spider_set_input_value('asc_or_desc', '<?php echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'name' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc'; ?> '); spider_form_submit(event, 'sliders_form')" href=""> <span>Name</span><span class="sorting-indicator"></span> </a> </th> <th class="table_big_col">Slides</th> <th class="table_big_col">Shortcode</th> <th class="table_large_col">PHP function</th> <th class="table_big_col <?php if ($order_by == 'published') { echo $order_class; } ?> "> <a onclick="spider_set_input_value('task', ''); spider_set_input_value('order_by', 'published'); spider_set_input_value('asc_or_desc', '<?php echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'published' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc'; ?> '); spider_form_submit(event, 'sliders_form')" href=""> <span>Published</span><span class="sorting-indicator"></span> </a> </th> <th class="table_big_col">Edit</th> <th class="table_big_col">Delete</th> </thead> <tbody id="tbody_arr"> <?php if ($rows_data) { foreach ($rows_data as $row_data) { $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"'; $published_image = $row_data->published ? 'publish' : 'unpublish'; $published = $row_data->published ? 'unpublish' : 'publish'; $prev_img_url = $this->model->get_slider_prev_img($row_data->id); $slides_count = $this->model->get_slides_count($row_data->id); ?> <tr id="tr_<?php echo $row_data->id; ?> " <?php echo $alternate; ?> > <td class="table_small_col check-column"><input id="check_<?php echo $row_data->id; ?> " name="check_<?php echo $row_data->id; ?> " onclick="spider_check_all(this)" type="checkbox" /></td> <td class="table_small_col"><?php echo $row_data->id; ?> </td> <td class="table_big_col"> <img title="<?php echo $row_data->name; ?> " style="border: 1px solid #CCCCCC; max-width: 70px; max-height: 50px;" src="<?php echo $prev_img_url . '?date=' . date('Y-m-y H:i:s'); ?> "> </td> <td> <a onclick="spider_set_input_value('task', 'edit'); spider_set_input_value('page_number', '1'); spider_set_input_value('search_value', ''); spider_set_input_value('search_or_not', ''); spider_set_input_value('asc_or_desc', 'asc'); spider_set_input_value('order_by', 'order'); spider_set_input_value('current_id', '<?php echo $row_data->id; ?> '); spider_form_submit(event, 'sliders_form')" href="" title="Edit"><?php echo $row_data->name; ?> </a> </td> <td class="table_big_col"><?php echo $slides_count; ?> </td> <td class="table_big_col" style="padding-left: 0; padding-right: 0;"> <input type="text" value='[wds id="<?php echo $row_data->id; ?> "]' onclick="spider_select_value(this)" size="11" readonly="readonly" style="padding-left: 1px; padding-right: 1px;" /> </td> <td class="table_large_col" style="padding-left: 0; padding-right: 0;"> <input type="text" value="<?php wd_slider(<?php echo $row_data->id; ?> ); ?>" onclick="spider_select_value(this)" size="23" readonly="readonly" style="padding-left: 1px; padding-right: 1px;" /> </td> <td class="table_big_col"><a onclick="spider_set_input_value('task', '<?php echo $published; ?> ');spider_set_input_value('current_id', '<?php echo $row_data->id; ?> ');spider_form_submit(event, 'sliders_form')" href=""><img src="<?php echo WD_S_URL . '/images/' . $published_image . '.png'; ?> "></img></a></td> <td class="table_big_col"><a onclick="spider_set_input_value('task', 'edit'); spider_set_input_value('page_number', '1'); spider_set_input_value('search_value', ''); spider_set_input_value('search_or_not', ''); spider_set_input_value('asc_or_desc', 'asc'); spider_set_input_value('order_by', 'order'); spider_set_input_value('current_id', '<?php echo $row_data->id; ?> '); spider_form_submit(event, 'sliders_form')" href="">Edit</a></td> <td class="table_big_col"><a onclick="spider_set_input_value('task', 'delete'); spider_set_input_value('current_id', '<?php echo $row_data->id; ?> '); spider_form_submit(event, 'sliders_form')" href="">Delete</a></td> </tr> <?php $ids_string .= $row_data->id . ','; } } ?> </tbody> </table> <input id="task" name="task" type="hidden" value="" /> <input id="current_id" name="current_id" type="hidden" value="" /> <input id="ids_string" name="ids_string" type="hidden" value="<?php echo $ids_string; ?> " /> <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="asc" /> <input id="order_by" name="order_by" type="hidden" value="<?php echo $order_by; ?> " /> </form> <?php }
public function display() { $slide_id = WDW_S_Library::get('slide_id', 0); if ($slide_id) { $single = 1; } else { $single = 0; } $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : ''; $category_id = isset($_POST['category_id']) ? esc_html(stripslashes($_POST['category_id'])) : ''; $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'ASC'; $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'date'; $count = isset($_GET['count']) ? esc_html(stripslashes($_GET['count'])) : 0; $order_class = 'manage-column column-title sorted ' . $asc_or_desc; $datas = $this->model->get_rows_data(); $rows_data = $datas[0]; $page_limit = $datas[2]; wp_print_scripts('jquery'); ?> <link media="all" type="text/css" href="<?php echo get_admin_url(); ?> load-styles.php?c=1&dir=ltr&load=admin-bar,wp-admin,dashicons,buttons,wp-auth-check" rel="stylesheet"> <?php if (get_bloginfo('version') < '3.9') { ?> <link media="all" type="text/css" href="<?php echo get_admin_url(); ?> css/colors<?php echo get_bloginfo('version') < '3.8' ? '-fresh' : ''; ?> .min.css" id="colors-css" rel="stylesheet"> <?php } ?> <link media="all" type="text/css" href="<?php echo WD_S_URL . '/css/wds_tables.css'; ?> " rel="stylesheet" /> <script src="<?php echo WD_S_URL . '/js/wds.js'; ?> " type="text/javascript"></script> <form class="wrap wp-core-ui" id="posts_form" method="post" action="<?php echo add_query_arg(array('action' => 'WDSPosts', 'width' => '700', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?> " style="width:99%; margin: 0 auto;"> <h2 style="float: left;">Posts</h2> <input type="button" class="button-primary" title="Add Post" onclick="wds_add_post(jQuery('#ids_string').val(), <?php echo $count; ?> ); window.parent.tb_remove();" style="float: right; margin: 9px 0;" value="Add to slider" /> <div class="tablenav top"> <?php WDW_S_Library::search('Title', $search_value, 'posts_form'); wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_id', 'orderby' => 'name', 'selected' => $category_id, 'hierarchical' => TRUE, 'show_option_none' => 'View all categories', 'class' => 'wds_category_name')); WDW_S_Library::html_page_nav($datas[1], $page_limit, 'posts_form'); ?> </div> <div class="spider_message"><div class="updated"><p><strong>You can include only posts with featured image.</strong></p></div></div> <table class="wp-list-table widefat fixed pages"> <thead> <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;" /></th> <th class="table_large_col">Featured image</th> <th class="<?php if ($order_by == 'title') { echo $order_class; } ?> "> <a onclick="spider_set_input_value('order_by', 'title'); spider_set_input_value('asc_or_desc', '<?php echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'title' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc'; ?> '); spider_form_submit(event, 'posts_form')" href=""> <span>Title</span><span class="sorting-indicator"></span> </a> </th> <th class="<?php if ($order_by == 'author') { echo $order_class; } ?> "> <a onclick="spider_set_input_value('order_by', 'author'); spider_set_input_value('asc_or_desc', '<?php echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'author' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc'; ?> '); spider_form_submit(event, 'posts_form')" href=""> <span>Author</span><span class="sorting-indicator"></span> </a> </th> <th class="table_small_col">Type</th> <th class="<?php if ($order_by == 'date') { echo $order_class; } ?> table_large_col"> <a onclick="spider_set_input_value('order_by', 'date'); spider_set_input_value('asc_or_desc', '<?php echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'date' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc'; ?> '); spider_form_submit(event, 'posts_form')" href=""> <span>Date created</span><span class="sorting-indicator"></span> </a> </th> <th class="<?php if ($order_by == 'modified') { echo $order_class; } ?> table_large_col"> <a onclick="spider_set_input_value('order_by', 'modified'); spider_set_input_value('asc_or_desc', '<?php echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'modified' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc'; ?> '); spider_form_submit(event, 'posts_form')" href=""> <span>Date modified</span><span class="sorting-indicator"></span> </a> </th> </thead> <tbody id="tbody_arr"> <?php $ids_string = ''; if ($rows_data) { foreach ($rows_data as $row_data) { $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"'; ?> <tr id="tr_<?php echo $row_data->id; ?> " <?php echo $alternate; ?> > <td class="table_small_col check-column"><input id="check_<?php echo $row_data->id; ?> " name="check_<?php echo $row_data->id; ?> " type="checkbox" /></td> <td class="table_large_col"> <img title="<?php echo $row_data->title; ?> " style="border: 1px solid #CCCCCC; max-width: 70px; max-height: 50px;" src="<?php echo $row_data->thumb_url; ?> " /> </td> <td><a onclick="jQuery('#check_<?php echo $row_data->id; ?> ').attr('checked', 'checked'); wds_add_post('<?php echo $row_data->id; ?> ,', <?php echo $single; ?> ); window.parent.tb_remove();" id="a_<?php echo $row_data->id; ?> " style="cursor: pointer;"><?php echo $row_data->title; ?> </a></td> <td><?php echo $row_data->author; ?> </td> <td class="table_small_col"><?php echo $row_data->type; ?> </td> <td class="table_large_col"><?php echo $row_data->date; ?> </td> <td class="table_large_col"><?php echo $row_data->modified; ?> </td> <input type="hidden" name="wds_title_<?php echo $row_data->id; ?> " id="wds_title_<?php echo $row_data->id; ?> " value="<?php echo $row_data->title; ?> " /> <input type="hidden" name="wds_image_url_<?php echo $row_data->id; ?> " id="wds_image_url_<?php echo $row_data->id; ?> " value="<?php echo $row_data->image_url; ?> " /> <input type="hidden" name="wds_thumb_url_<?php echo $row_data->id; ?> " id="wds_thumb_url_<?php echo $row_data->id; ?> " value="<?php echo $row_data->thumb_url; ?> " /> <input type="hidden" name="wds_link_<?php echo $row_data->id; ?> " id="wds_link_<?php echo $row_data->id; ?> " value="<?php echo $row_data->link; ?> " /> <input type="hidden" name="wds_content_<?php echo $row_data->id; ?> " id="wds_content_<?php echo $row_data->id; ?> " value="<?php echo esc_html($row_data->content); ?> " /> </tr> <?php $ids_string .= $row_data->id . ','; } } ?> </tbody> </table> <input id="asc_or_desc" name="asc_or_desc" type="hidden" value="<?php echo $asc_or_desc; ?> " /> <input id="order_by" name="order_by" type="hidden" value="<?php echo $order_by; ?> " /> <input id="slide_id" name="slide_id" type="hidden" value="<?php echo $slide_id; ?> " /> <input id="ids_string" name="ids_string" type="hidden" value="<?php echo $ids_string; ?> " /> <input id="task" name="task" type="hidden" value="" /> </form> <style> .wds_category_name { margin: 3px; <?php echo get_bloginfo('version') > '3.7' ? ' height: 28px;' : ''; ?> } </style> <script> jQuery(window).load(function () { jQuery(".wds_category_name").change(function () { jQuery("#page_number").val(1); jQuery("#search_or_not").val("search"); jQuery("#posts_form").submit(); }); <?php if ($count) { ?> jQuery("input[type='checkbox']").on("click", function() { jQuery("input[type='checkbox']").attr('checked', false); jQuery(this).attr('checked', true); }); <?php } ?> }); </script> <script src="<?php echo get_admin_url(); ?> load-scripts.php?c=1&load%5B%5D=common,admin-bar" type="text/javascript"></script> <?php die; }