public function display() { $slide_id = WDW_PS_Library::get('slide_id', 0); if ($slide_id) { $single = 1; } else { $single = 0; } $slider_id = WDW_PS_Library::get('slider_id', 0); $slider_row = $this->model->get_slider_row_data($slider_id); /*if(!$slider_id) { $layer_word_count = 250; } else { $layer_word_count = $slider_row->layer_word_count; }*/ $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : ''; $category_id = isset($_POST['category_id']) ? esc_html(stripslashes($_POST['category_id'])) : ''; $post_t = isset($_POST['archive-dropdown']) ? esc_html(stripslashes($_POST['archive-dropdown'])) : 'post'; $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]; $json = $datas[3]; $k = array(); foreach ($json as $keys => $jsonik) { array_push($k, $keys); } $post_feilds_name = $datas[4]; $page_limit = $datas[2]; $args = array('public' => true, 'publicly_queryable' => true, 'show_ui' => true, '_builtin' => false); $output = 'names'; // names or objects, note names is the default $operator = 'or'; // 'and' or 'or' $post_types = get_post_types($args, $output, $operator); $args = array('object_type' => array($post_t)); $output = 'names'; // or objects $operator = 'and'; // 'and' or 'or' $taxonomies = get_taxonomies($args, $output, $operator); $argss = array('orderby' => 'id', 'order' => 'ASC', 'hide_empty' => false); $terms = get_terms($taxonomies, $argss); foreach ($taxonomies as $taxonomie) { $termsss = isset($_POST['taxonomies_' . $taxonomie]) && esc_html(stripslashes($_POST['taxonomies_' . $taxonomie])) != -1 ? esc_html(stripslashes($_POST['taxonomies_' . $taxonomie])) : ''; } 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_PS_URL . '/css/wdps_tables.css'; ?> " rel="stylesheet" /> <link media="all" type="text/css" href="<?php echo WD_PS_URL . '/css/wdps_tables_640.css'; ?> " rel="stylesheet" /> <link media="all" type="text/css" href="<?php echo WD_PS_URL . '/css/wdps_tables_320.css'; ?> " rel="stylesheet" /> <script src="<?php echo WD_PS_URL . '/js/wdps.js'; ?> " type="text/javascript"></script> <form class="wrap wp-core-ui" id="posts_form" method="post" action="<?php echo add_query_arg(array('action' => 'WDPSPosts', 'width' => '700', 'height' => '550', 'TB_iframe' => '1'), admin_url('admin-ajax.php')); ?> " style="width:99%; margin: 0 auto;"> <h2 style="float: left;"><?php echo __('Posts', 'wdps_back'); ?> </h2> <input type="button" class="button-primary" title="<?php echo __('Add Post', 'wdps_back'); ?> " onclick="wdps_add_post(jQuery('#ids_string').val(), <?php echo $count; ?> ); window.parent.tb_remove();" style="float: right; margin: 9px 0;" value="<?php echo __('Add to slider', 'wdps_back'); ?> " /> <div class="tablenav top"> <?php WDW_PS_Library::search('Title', $search_value, 'posts_form'); WDW_PS_Library::html_page_nav($datas[1], $page_limit, 'posts_form'); ?> </div> <div class="tablenav top"> <label><?php echo __('Post type:', 'wdps_back'); ?> </label> <select name="archive-dropdown" id="archive-dropdown"> <?php foreach ($post_types as $post_type) { if ($post_type != 'page' && $post_type != 'attachment' && $post_type != 'nav_menu_item' && $post_type != 'revision') { ?> <option <?php echo $post_type == $post_t ? 'selected="selected"' : ''; ?> > <?php echo '<p>' . $post_type . '</p>'; ?> </option > <?php } } ?> </option> </select> </div> <?php foreach ($taxonomies as $taxonomie) { if (get_terms($taxonomie, $argss)) { $termsss = isset($_POST['taxonomies_' . $taxonomie]) && esc_html(stripslashes($_POST['taxonomies_' . $taxonomie])) != -1 ? esc_html(stripslashes($_POST['taxonomies_' . $taxonomie])) : __('-all-', 'wdps_back'); ?> <label><?php echo $taxonomie . ':'; ?> </label> <select style="margin:5px 0 0 7px" name="taxonomies_<?php echo $taxonomie; ?> " id="taxonomies_<?php echo $taxonomie; ?> " > <option value="" > <?php echo '<p>' . __('-all-', 'wdps_back') . '</p>'; ?> </option> <?php foreach ($terms as $term) { if ($taxonomie == $term->taxonomy) { ?> <option <?php echo $termsss == $term->slug ? 'selected="selected"' : ''; ?> value="<?php echo $term->slug; ?> "> <?php echo $term->name; ?> </option > <?php } } ?> </select> <?php } } ?> <div class="spider_message" style="padding:13px;" ><div class="wd_updated"><p><strong><?php echo __('You can include only published posts with featured image.', 'wdps_back'); ?> </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 mobiel_width"><?php echo __('Featured image', 'wdps_back'); ?> </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><?php echo __('Title', 'wdps_back'); ?> </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><?php echo __('Author', 'wdps_back'); ?> </span><span class="sorting-indicator"></span> </a> </th> <th class="table_small_col mobile_hide"><?php echo __('Type', 'wdps_back'); ?> </th> <th class="mobile_hide <?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><?php echo __('Date created', 'wdps_back'); ?> </span><span class="sorting-indicator"></span> </a> </th> <th class="mobile_hide <?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><?php echo __('Date modified', 'wdps_back'); ?> </span><span class="sorting-indicator"></span> </a> </th> </thead> <tbody id="tbody_arr"> <?php $ids_string = ''; if ($rows_data) { $l = 0; foreach ($rows_data as $key => $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'); wdps_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="mobile_hide table_small_col"><?php echo $row_data->type; ?> </td> <td class="mobile_hide table_large_col"><?php echo $row_data->date; ?> </td> <td class="mobile_hide table_large_col"><?php echo $row_data->modified; ?> </td> <input type="hidden" name="wdps_title_<?php echo $row_data->id; ?> " id="wdps_title_<?php echo $row_data->id; ?> " value="<?php echo $row_data->title; ?> " /> <input type="hidden" name="wdps_image_url_<?php echo $row_data->id; ?> " id="wdps_image_url_<?php echo $row_data->id; ?> " value="<?php echo $row_data->image_url; ?> " /> <input type="hidden" name="wdps_thumb_url_<?php echo $row_data->id; ?> " id="wdps_thumb_url_<?php echo $row_data->id; ?> " value="<?php echo $row_data->thumb_url; ?> " /> <input type="hidden" name="wdps_link_<?php echo $row_data->id; ?> " id="wdps_link_<?php echo $row_data->id; ?> " value="<?php echo $row_data->link; ?> " /> <input type="hidden" name="wdps_content_<?php echo $row_data->id; ?> " id="wdps_content_<?php echo $row_data->id; ?> " value="<?php echo "{post_content}"; ?> " /> <input type="hidden" name="post_feild_val<?php echo $row_data->id; ?> " id="post_feild_val<?php echo $row_data->id; ?> " value='<?php echo json_encode($post_feilds_name[$k[$l++]], JSON_HEX_APOS); ?> ' /> </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> .wdps_category_name { margin: 3px; <?php echo get_bloginfo('version') > '3.7' ? ' height: 28px;' : ''; ?> } </style> <script> jQuery(window).load(function () { jQuery(".wdps_category_name").change(function () { jQuery("#page_number").val(1); jQuery("#search_or_not").val("search"); jQuery("#posts_form").submit(); }); jQuery("#archive-dropdown").change(function () { jQuery("#page_number").val(1); jQuery("#posts_form").submit(); }); jQuery("#archive").change(function () { jQuery("#page_number").val(1); 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; }
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'; $post_t = isset($_POST['archive-dropdown']) ? esc_html(stripslashes($_POST['archive-dropdown'])) : ''; $order_class = 'manage-column column-title sorted ' . $asc_or_desc; $ids_string = ''; ?> <style> <?php global $wp_version; if (version_compare($wp_version, '4', '<')) { ?> #wpwrap { background-color:#F1F1F1 } @media screen and (max-width: 640px) { .buttons_div input { width:31%; font-size:10px; } .tablenav{ height:auto } #wpcontent{ margin-left:40px!important } .alignleft { display:none; } } <?php } ?> </style> <div style="clear: both; float: left; width: 99%;"> <div style="float: left; font-size: 14px; font-weight: bold;"> <?php echo __('This section allows you to create, edit and delete post sliders.', 'wdps_back'); ?> <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-post-slider-wd/creating-post-sliders.html"><?php echo __('Read More in User Manual', 'wdps_back'); ?> </a> </div> <div style="float: right; text-align: right;"> <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/frompostslider.php"> <img width="215" border="0" alt="web-dorado.com" src="<?php echo WD_PS_URL . '/images/wd_logo.png'; ?> " /> </a> </div> </div> <form class="wrap wdps_form" id="sliders_form" method="post" action="admin.php?page=sliders_wdps" style="width: 99%;"> <?php wp_nonce_field('nonce_wd', 'nonce_wd'); ?> <span class="slider-icon"></span> <h2> <?php echo __('Post Sliders', 'wdps_back'); ?> <a href="" class="add-new-h2" onclick="spider_set_input_value('task', 'add'); spider_form_submit(event, 'sliders_form')"><?php echo __('Add new', 'wdps_back'); ?> </a> </h2> <div class="tablenav top" style="margin-bottom:25px"> <?php WDW_PS_Library::search('Name', $search_value, 'sliders_form'); /*WDW_PS_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'sliders_form');*/ ?> <div class="buttons_div"> <span class="wdps_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;"><?php echo __('Select All', 'wdps_back'); ?> </span> </span> <input class="wdps_button-secondary wdps_publish_all" type="submit" onclick="spider_set_input_value('task', 'publish_all')" value="<?php echo __('Publish', 'wdps_back'); ?> " /> <input class="wdps_button-secondary wdps_unpublish_all" type="submit" onclick="spider_set_input_value('task', 'unpublish_all')" value=" <?php echo __('Unpublish', 'wdps_back'); ?> " /> <input class="wdps_button-secondary wdps_duplicate_all" type="submit" onclick="spider_set_input_value('task', 'duplicate_all')" value="<?php echo __('Duplicate', 'wdps_back'); ?> " /> <input class="wdps_button-secondary wdps_delete_all" type="submit" onclick="if (confirm('<?php echo addslashes(__('Do you want to delete selected items?', 'wdps_back')); ?> ')) { spider_set_input_value('task', 'delete_all'); } else { return false; }" value="<?php echo __('Delete', 'wdps_back'); ?> " /> </div> </div> <?php WDW_PS_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'sliders_form'); ?> <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="mobile_hide table_big_col"><?php echo __('Slider', 'wdps_back'); ?> </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><?php echo __('Name', 'wdps_back'); ?> </span><span class="sorting-indicator"></span> </a> </th> <th class="mobile_hide table_big_col"><?php echo __('Slides', 'wdps_back'); ?> </th> <th class="table_big_col"><?php echo __('Shortcode', 'wdps_back'); ?> </th> <th class="mobile_hide table_large_col"><?php echo __('PHP function', 'wdps_back'); ?> </th> <th class="mobile_hide 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><?php echo __('Published', 'wdps_back'); ?> </span><span class="sorting-indicator"></span> </a> </th> <th class="mobile_hide table_big_col wdps_table_big_col_action" colspan='3'><?php echo __('Action', 'wdps_back'); ?> </th> </thead> <tbody id="tbody_arr"> <?php if ($rows_data) { $alternate = ''; foreach ($rows_data as $row_data) { $alternate = !isset($alternate) || $alternate == 'class="wdps_alternate"' ? '' : 'class="wdps_alternate"'; $published_image = $row_data->published ? 'publish_slide' : 'unpublish_slide'; $published = $row_data->published ? 'unpublish' : 'publish'; $prev_img_url = $this->model->get_slider_prev_img($row_data->id); //$prev_img_url; $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="mobile_hide 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 class="wdps_640"> <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="<?php echo __('Edit', 'wdps_back'); ?> "><?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='[wdps 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="mobile_hide table_large_col" style="padding-left: 0; padding-right: 0;"> <input type="text" value="<?php wdp_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="mobile_hide 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_PS_URL . '/images/sliderwdpng/' . $published_image . '.png'; ?> "></img></a></td> <td class="mobile_hide table_big_col" colspan="3"> <div class='slider_edit_buttons'> <div class="slider_edit"> <input type="button" value="<?php echo __('Edit', 'wdps_back'); ?> " class="action_buttons edit_slider" 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')" /> </div> <!-- <div class="slider_duplicate"> <input class="action_buttons wdps_duplicate_slider" type="submit" onclick="spider_set_input_value('current_id', '<?php echo $row_data->id; ?> '); spider_set_input_value('task', 'duplicate_all'); spider_form_submit(event, 'sliders_form')" value="<?php echo __('Duplicate', 'wdps_back'); ?> " /> </div>--> <div class="slider_delete"> <input type="button" class="action_buttons wdps_delete_slider" value="<?php echo __('Delete', 'wdps_back'); ?> " onclick="if (confirm('<?php echo addslashes(__('Do you want to delete selected items?', 'wdps_back')); ?> ')) {spider_set_input_value('task', 'delete'); spider_set_input_value('current_id', '<?php echo $row_data->id; ?> '); spider_form_submit(event, 'sliders_form')} else {return false;}" /> </div> <div class="clear"></div> </div> </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 }