public function display()
    {
        global $WD_BWG_UPLOAD_DIR;
        $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'])) : 'order';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        $per_page = $this->model->per_page();
        $pager = 0;
        $gallery_button_array = array('publish_all' => __('Publish', 'bwg_back'), 'unpublish_all' => __('Unpublish', 'bwg_back'), 'delete_all' => __('Delete', 'bwg_back'));
        ?>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        <?php 
        _e("This section allows you to create, edit and delete galleries.", 'bwg_back');
        ?>
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-gallery/creating-editing-galleries.html"><?php 
        _e("Read More in User Manual", 'bwg_back');
        ?>
</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromPhotoGallery.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_BWG_URL . '/images/logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form class="wrap bwg_form" id="galleries_form" method="post" action="admin.php?page=galleries_bwg" style="float: left; width: 99%;">
      <?php 
        wp_nonce_field('galleries_bwg', 'bwg_nonce');
        ?>
      <span class="gallery-icon"></span>
      <h2>
        <?php 
        _e("Galleries", 'bwg_back');
        ?>
        <a href="" id="galleries_id" class="add-new-h2" onclick="spider_set_input_value('task', 'add');
                                               spider_form_submit(event, 'galleries_form')"><?php 
        _e("Add new", 'bwg_back');
        ?>
</a>
      </h2>
      <div id="draganddrop" class="wd_updated" style="display:none;"><strong><p><?php 
        _e("Changes made in this table should be saved.", 'bwg_back');
        ?>
</p></strong></div>
      <?php 
        WDWLibrary::search(__('Name', 'bwg_back'), $search_value, 'galleries_form', '');
        ?>
      <div class="tablenav top buttons_div" >
        <span class="wd-btn wd-btn-primary-gray bwg_check_all  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', 'bwg_back');
        ?>
</span>
        </span>
        <select class='select_icon bulk_action'>
          <option value=""><?php 
        _e('Bulk Actions', 'bwg_back');
        ?>
</option>
        <?php 
        foreach ($gallery_button_array as $key => $value) {
            ?>
          <option value="<?php 
            echo $key;
            ?>
">
            <?php 
            echo $value;
            ?>
          </option>
        <?php 
        }
        ?>
        </select>
        <input class="wd-btn wd-btn-primary wd-btn-icon wd-btn-apply" type="button" title="<?php 
        _e("Apply", "bwg_back");
        ?>
" onclick="if (!bwg_bulk_actions('.bulk_action', 'gallery_page')) {return false;}" value="<?php 
        _e("Apply", "bwg_back");
        ?>
" />
        <?php 
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'galleries_form', $per_page);
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
        <th class="sortable check-column table_small_col manage-column <?php 
        if ($order_by == 'order') {
            echo $order_class;
        }
        ?>
" style="margin: 0px auto 5px 15px; width: 77px; vertical-align: middle;">
          <a id="show_hide_weights" class="bwg_order_column" title="<?php 
        echo __('Hide order column', 'bwg_back');
        ?>
" onclick="spider_show_hide_weights();" value="<?php 
        echo __('Hide order column', 'bwg_back');
        ?>
" ></a>
          <a id="show_order_button" class="bwg_save_order" title="<?php 
        echo __('Save Order', 'bwg_back');
        ?>
"  onclick="spider_set_input_value('task', 'save_order');spider_form_submit(event, 'galleries_form')" value="<?php 
        echo __('Save Order', 'bwg_back');
        ?>
" ></a>
            <a id="th_order"  onclick="spider_set_input_value('task', '');
                        spider_set_input_value('order_by', 'order');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'order' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'galleries_form')" href="">
             <span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="sortable manage-column column-cb check-column table_small_col" style="padding-top:15px !important;"><input id="check_all" type="checkbox" onclick="spider_check_all(this)" style="margin:0" /></th>
          <th class="sortable table_th_middle 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, 'galleries_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="table_extra_large_col"><?php 
        echo __('Thumbnail', 'bwg_back');
        ?>
</th>
          <th class="sortable <?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, 'galleries_form')" href="">
              <span><?php 
        echo __('Name', 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="sortable <?php 
        if ($order_by == 'slug') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
                        spider_set_input_value('order_by', 'slug');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'slug' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'galleries_form')" href="">
              <span><?php 
        echo __('Slug', 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="sortable <?php 
        if ($order_by == 'display_name') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
                        spider_set_input_value('order_by', 'display_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'])) == 'display_name' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'galleries_form')" href="">
              <span><?php 
        echo __('Author', 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
					<th class="table_big_col"><?php 
        echo __('Images count', 'bwg_back');
        ?>
</th>
          <th class="sortable table_big_col <?php 
        if ($order_by == 'published') {
            echo $order_class;
        }
        ?>
" style="padding-left:30px;">
            <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, 'galleries_form')" href="">
              <span><?php 
        echo __('Published', 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="table_small_col"><?php 
        echo __('Edit', 'bwg_back');
        ?>
</th>
          <th  class="table_small_col"><?php 
        echo __('Delete', 'bwg_back');
        ?>
</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-blue' : 'unpublish-red';
                $published = $row_data->published ? 'unpublish' : 'publish';
                $unpublish = !$row_data->published ? 'Unpublish' : 'Publish';
                $images_count = $this->model->get_images_count($row_data->id);
                if ($row_data->preview_image == '') {
                    $preview_image = WD_BWG_URL . '/images/no-image.png';
                } else {
                    $preview_image = site_url() . '/' . $WD_BWG_UPLOAD_DIR . $row_data->preview_image;
                }
                ?>
              <tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="spider_order table_medium_col"><input id="order_input_<?php 
                echo $row_data->id;
                ?>
" name="order_input_<?php 
                echo $row_data->id;
                ?>
" type="text" size="1" value="<?php 
                echo $row_data->order;
                ?>
" /></td>
                <td class="connectedSortable handles table_small_col"><div title="Drag to re-order" class="handle" style="margin:5px auto 0 auto;"></div></td>
                <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_extra_large_col">
                  <img title="<?php 
                echo $row_data->name;
                ?>
" style="border: 1px solid #CCCCCC; max-width:60px; max-height:60px;" src="<?php 
                echo $preview_image . '?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, 'galleries_form')" href="" title="<?php 
                _e("Edit", 'bwg_back');
                ?>
"><?php 
                echo $row_data->name;
                ?>
</a></td>
                <td><?php 
                echo $row_data->slug;
                ?>
</td>
                <td><?php 
                echo get_userdata($row_data->author)->display_name;
                ?>
</td>
								<td class="table_large_col"><?php 
                echo $images_count;
                ?>
</td>
                <td class="table_big_col publish_icon"><a style="background-image:url('<?php 
                echo WD_BWG_URL . '/images/icons/' . $published_image . '.png';
                ?>
'); background-repeat: no-repeat; display: inline-block; width: 18px; height: 22px;margin: 3px; vertical-align: middle;background-size: contain;" title="<?php 
                echo $unpublish;
                ?>
" onclick="spider_set_input_value('task', '<?php 
                echo $published;
                ?>
');spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');spider_form_submit(event, 'galleries_form')" href=""></a></td>
                <td class="table_big_col"><a class="bwg_img_edit" title="<?php 
                echo __('Edit', 'bwg_back');
                ?>
" 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, 'galleries_form')" href=""></a></td>
                <td class="table_big_col"><a class="bwg_img_remove" title="<?php 
                echo __('Delete', 'bwg_back');
                ?>
" onclick="if (confirm('<?php 
                echo addslashes(__('Do you want to delete selected items?', 'bwg_back'));
                ?>
')) {
                                                      spider_set_input_value('task', 'delete');
                                                      spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                                                      spider_form_submit(event, 'galleries_form')
                                                      } else {
                                                       return false;
                                                      }" href=""></a></td>
              </tr>
              <?php 
                $ids_string .= $row_data->id . ',';
            }
        }
        ?>
        </tbody>
      </table>
      <div class="tablenav bottom">
        <?php 
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'galleries_form', $per_page);
        ?>
      </div>
      <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;
        ?>
" />
      <script>
        window.onload = spider_show_hide_weights;
      </script>
    </form>
    <?php 
    }
Example #2
0
    public function display()
    {
        $rows_data = $this->model->get_rows_data();
        $page_nav = $this->model->page_nav();
        $search_value = isset($_POST['search_value']) ? esc_html($_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($_POST['asc_or_desc']) : 'asc';
        $order_by = isset($_POST['order_by']) ? esc_html($_POST['order_by']) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        $per_page = $this->model->per_page();
        ?>
    <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 themes.
        <a style="color: blue; text-decoration: none;" target="_blank" href="http://web-dorado.com/wordpress-gallery-guide-step-6/6-1.html">Read More in User Manual</a>
        <?php 
        if (get_option("wd_bwg_theme_version")) {
            ?>
          <br />
          This feature is disabled for the non-commercial version.
          <?php 
        }
        ?>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="http://web-dorado.com/products/wordpress-photo-gallery-plugin.html">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_BWG_URL . '/images/logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <?php 
        if (get_option("wd_bwg_theme_version")) {
            ?>
      <div style="clear: both; float: left; width: 97%;">
        <img style="max-width: 100%;" src="<?php 
            echo WD_BWG_URL . '/images/theme_thumbnails.png';
            ?>
" />
        <img style="max-width: 100%;" src="<?php 
            echo WD_BWG_URL . '/images/theme_masonry.png';
            ?>
" />
        <img style="max-width: 100%;" src="<?php 
            echo WD_BWG_URL . '/images/theme_slideshow.png';
            ?>
" />
        <img style="max-width: 100%;" src="<?php 
            echo WD_BWG_URL . '/images/theme_image_browser.png';
            ?>
" />
        <img style="max-width: 100%;" src="<?php 
            echo WD_BWG_URL . '/images/theme_compact_album.png';
            ?>
" />
        <img style="max-width: 100%;" src="<?php 
            echo WD_BWG_URL . '/images/theme_extended_album.png';
            ?>
" />
        <img style="max-width: 100%;" src="<?php 
            echo WD_BWG_URL . '/images/theme_blog_style.png';
            ?>
" />
        <img style="max-width: 100%;" src="<?php 
            echo WD_BWG_URL . '/images/theme_lightbox.png';
            ?>
" />
        <img style="max-width: 100%;" src="<?php 
            echo WD_BWG_URL . '/images/theme_page_navigation.png';
            ?>
" />
      </div>
      <?php 
            die;
        }
        ?>
    <form class="wrap" id="themes_form" method="post" action="admin.php?page=themes_bwg" style="float: left; width: 99%;">
      <?php 
        wp_nonce_field('themes_bwg', 'bwg_nonce');
        ?>
      <span class="theme_icon"></span>
      <h2>
        Themes
        <a href="" class="add-new-h2" onclick="spider_set_input_value('task', 'add');
                                               spider_form_submit(event, 'themes_form')">Add new</a>
      </h2>
      <div class="buttons_div">
        <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 
        WDWLibrary::search('Title', $search_value, 'themes_form');
        WDWLibrary::html_page_nav($page_nav['total'], $page_nav['limit'], 'themes_form', $per_page);
        ?>
      </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_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($_POST['order_by']) == 'id' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span></a>
          </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($_POST['order_by']) == 'title' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>Name</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="table_big_col <?php 
        if ($order_by == 'default_theme') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
              spider_set_input_value('order_by', 'default_theme');
              spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html($_POST['order_by']) == 'default_theme' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>Default</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"';
                $default_image = $row_data->default_theme ? 'default' : 'notdefault';
                $default = $row_data->default_theme ? '' : 'setdefault';
                ?>
              <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_small_col"><?php 
                echo $row_data->id;
                ?>
</td>
                <td>
                  <a onclick="spider_set_input_value('task', 'edit');
                              spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              spider_form_submit(event, 'themes_form')" href="" title="Edit"><?php 
                echo $row_data->name;
                ?>
</a>
                </td>
                <td class="table_big_col">
                  <?php 
                if ($default != '') {
                    ?>
                    <a onclick="spider_set_input_value('task', '<?php 
                    echo $default;
                    ?>
');
                                spider_set_input_value('current_id', '<?php 
                    echo $row_data->id;
                    ?>
');
                                spider_form_submit(event, 'themes_form')" href="">
                    <?php 
                }
                ?>
                  <img src="<?php 
                echo WD_BWG_URL . '/images/' . $default_image . '.png';
                ?>
" />
                  <?php 
                if ($default != '') {
                    ?>
                    </a>
                    <?php 
                }
                ?>
                </td>
                <td class="table_big_col">
                  <a onclick="spider_set_input_value('task', 'edit');
                              spider_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              spider_form_submit(event, 'themes_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, 'themes_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()
    {
        $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'])) : '';
        $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'])) : 'A.term_id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        $per_page = $this->model->per_page();
        $pager = 0;
        $query_url = wp_nonce_url(admin_url('admin-ajax.php'), '', 'bwg_nonce');
        $query_url = add_query_arg(array('action' => ''), $query_url);
        ?>
    <script>
      var ajax_url = "<?php 
        echo $query_url;
        ?>
"
    </script>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        <?php 
        _e("This section allows you to create, edit and delete tags.", 'bwg_back');
        ?>
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-gallery-guide-step-3.html"><?php 
        _e("Read More in User Manual", 'bwg_back');
        ?>
</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromPhotoGallery.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_BWG_URL . '/images/logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <div id="wordpress_message_1" style="width:99%;display:none"><div id="wordpress_message_2" class="updated"><p><strong><?php 
        _e("Item Succesfully Saved.", 'bwg_back');
        ?>
</strong></p></div></div>
    <form class="wrap" id="tags_form" method="post" action="admin.php?page=tags_bwg" style="float:left; width: 99%;">
      <?php 
        wp_nonce_field('tags_bwg', 'bwg_nonce');
        ?>
      <span class="tag_icon"></span>
      <h2><?php 
        _e("Tags", 'bwg_back');
        ?>
</h2>
      <div class="buttons_div">
        <input class="button-secondary" type="submit" value="<?php 
        _e("Save", 'bwg_back');
        ?>
" onclick="if (confirm('Do you want to save items?')){
                                                                    spider_set_input_value('task', 'edit_tags');
                                                                  } else {
                                                                    return false;
                                                                  }" />
        <input class="button-secondary" type="submit" value="<?php 
        _e("Delete", 'bwg_back');
        ?>
" onclick="if (confirm('Do you want to delete selected items?')) {
                                                                      spider_set_input_value('task', 'delete_all');
                                                                    } else {
                                                                      return false;
                                                                    }" />
      </div>
      <div class="tablenav top">
        <?php 
        WDWLibrary::search(__("Name", 'bwg_back'), $search_value, 'tags_form');
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'tags_form', $per_page);
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
          <tr>
            <th class="manage-column column-cb check-column table_small_col"><input id="check_all" type="checkbox" style="margin:0;" /></th>
            <th class="table_small_col <?php 
        if ($order_by == 'A.term_id') {
            echo $order_class;
        }
        ?>
">
              <a onclick="spider_set_input_value('task', '');
                          spider_set_input_value('order_by', 'A.term_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'])) == 'A.term_id' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                          spider_form_submit(event, 'tags_form')" href="">
                <span>ID</span><span class="sorting-indicator"></span></th>
              </a>
            <th class="<?php 
        if ($order_by == 'A.name') {
            echo $order_class;
        }
        ?>
">
              <a onclick="spider_set_input_value('task', '');
                          spider_set_input_value('order_by', 'A.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'])) == 'A.name' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                          spider_form_submit(event, 'tags_form')" href="">
                <span><?php 
        _e("Name", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
              </a>
            </th>
            <th class="<?php 
        if ($order_by == 'A.slug') {
            echo $order_class;
        }
        ?>
">
              <a onclick="spider_set_input_value('task', '');
                          spider_set_input_value('order_by', 'A.slug');
                          spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'A.slug' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                          spider_form_submit(event, 'tags_form')" href="">
                <span><?php 
        _e("Slug", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
              </a>
            </th>
            <th class="<?php 
        if ($order_by == 'B.count') {
            echo $order_class;
        }
        ?>
 table_big_col ">
              <a onclick="spider_set_input_value('task', '');
                          spider_set_input_value('order_by', 'B.count');
                          spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'B.count' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                          spider_form_submit(event, 'tags_form')" href="">
                <span><?php 
        _e("Count", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
              </a>
            </th>
            <th class="table_big_col"><?php 
        _e("Edit", 'bwg_back');
        ?>
</th>
            <th class="table_big_col"><?php 
        _e("Delete", 'bwg_back');
        ?>
</th>
          </tr>		  
          <tr id="tr">
            <th></th>
            <th></th>
            <th class="edit_input">
              <input class="input_th" name="tagname" type="text" value="">
            </th>
            <th class="edit_input">
              <input class="input_th" name="slug" type="text" value="">
            </th>
            <th></th>
            <th class="table_big_col">
              <a class="add_tag_th button-primary button button-small" onclick="spider_set_input_value('task', 'save');
                                                                                spider_set_input_value('current_id', '');
                                                                                spider_form_submit(event, 'tags_form')" href=""><?php 
        _e("Add Tag", 'bwg_back');
        ?>
 </a>
            </th>
            <th></th>
          </tr>
        </thead>
        <tbody id="tbody_arr">
          <?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                ?>
              <tr id="tr_<?php 
                echo $row_data->term_id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column" id="td_check_<?php 
                echo $row_data->term_id;
                ?>
" ><input id="check_<?php 
                echo $row_data->term_id;
                ?>
" name="check_<?php 
                echo $row_data->term_id;
                ?>
" type="checkbox" /></td>
                <td class="table_small_col" id="td_id_<?php 
                echo $row_data->term_id;
                ?>
" ><?php 
                echo $row_data->term_id;
                ?>
</td>
                <td id="td_name_<?php 
                echo $row_data->term_id;
                ?>
" >
                  <a class="pointer" id="name<?php 
                echo $row_data->term_id;
                ?>
"
                     onclick="edit_tag(<?php 
                echo $row_data->term_id;
                ?>
)" 
                     title="<?php 
                _e("Edit", 'bwg_back');
                ?>
"><?php 
                echo $row_data->name;
                ?>
</a>
                </td>
                <td id="td_slug_<?php 
                echo $row_data->term_id;
                ?>
">
                  <a class="pointer"
                     id="slug<?php 
                echo $row_data->term_id;
                ?>
"
                     onclick="edit_tag(<?php 
                echo $row_data->term_id;
                ?>
)" 
                     title="<?php 
                _e("Edit", 'bwg_back');
                ?>
"><?php 
                echo $row_data->slug;
                ?>
</a>
                </td>
                <td class="table_big_col" id="td_count_<?php 
                echo $row_data->term_id;
                ?>
" >
                  <a class="pointer"
                     id="count<?php 
                echo $row_data->term_id;
                ?>
"
                     onclick="edit_tag(<?php 
                echo $row_data->term_id;
                ?>
)"
                     title="<?php 
                _e("Edit", 'bwg_back');
                ?>
"><?php 
                echo $this->model->get_count_of_images($row_data->term_id);
                ?>
</a>
                </td>
                <td class="table_big_col" id="td_edit_<?php 
                echo $row_data->term_id;
                ?>
">
                  <a onclick="edit_tag(<?php 
                echo $row_data->term_id;
                ?>
)"><?php 
                _e("Edit", 'bwg_back');
                ?>
</a>
                </td>
                <td class="table_big_col" id="td_delete_<?php 
                echo $row_data->term_id;
                ?>
">
                  <a onclick="spider_set_input_value('task', 'delete');
                              spider_set_input_value('current_id', <?php 
                echo $row_data->term_id;
                ?>
);
                              spider_form_submit(event, 'tags_form')" href=""><?php 
                _e("Delete", 'bwg_back');
                ?>
</a>
                </td>
              </tr>
              <?php 
                $ids_string .= $row_data->term_id . ',';
            }
        }
        ?>
        </tbody>
      </table>
      <div class="tablenav bottom">
        <?php 
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'tags_form', $per_page);
        ?>
      </div>
      <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="<?php 
        echo $asc_or_desc;
        ?>
" />
      <input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
" />
    </form>
    <?php 
    }
    public function display()
    {
        global $WD_BWG_UPLOAD_DIR;
        $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'])) : 'order';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div style="clear: both; float: left; width: 95%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to create, edit and delete galleries.
        <a style="color: blue; text-decoration: none;" target="_blank" href="http://web-dorado.com/wordpress-gallery-guide-step-2.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="color: red; text-decoration: none;" target="_blank" href="http://web-dorado.com/products/wordpress-photo-gallery-plugin.html">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_BWG_URL . '/images/header.png';
        ?>
" />
          <p style="font-size: 16px; margin: 0; padding: 0 20px 0 0;">Get the full version</p>
        </a>
      </div>
    </div>
    <form class="wrap" id="galleries_form" method="post" action="admin.php?page=galleries_bwg" style="float: left; width: 95%;">
      <span class="gallery-icon"></span>
      <h2>
        Galleries
        <a href="" class="add-new-h2" onclick="spider_set_input_value('task', 'add');
                                               spider_form_submit(event, 'galleries_form')">Add new</a>
      </h2>
      <div id="draganddrop" class="updated" style="display:none;"><strong><p>Changes made in this table shoud be saved.</p></strong></div>
      <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 id="show_hide_weights"  class="button-secondary" type="button" onclick="spider_show_hide_weights();return false;" value="Hide order column" />
        <input class="button-secondary" type="submit" onclick="spider_set_input_value('task', 'save_order')" value="Save Order" />
        <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="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 
        WDWLibrary::search('Name', $search_value, 'galleries_form');
        WDWLibrary::html_page_nav($page_nav['total'], $page_nav['limit'], 'galleries_form');
        ?>
      </div>
      <table class="wp-list-table widefat fixed pages">
        <thead>
          <th class="table_small_col"></th>
          <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, 'galleries_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="table_extra_large_col">Thumbnail</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, 'galleries_form')" href="">
              <span>Name</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="<?php 
        if ($order_by == 'slug') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
                        spider_set_input_value('order_by', 'slug');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'slug' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'galleries_form')" href="">
              <span>Slug</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="<?php 
        if ($order_by == 'display_name') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
                        spider_set_input_value('order_by', 'display_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'])) == 'display_name' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'galleries_form')" href="">
              <span>Author</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th id="th_order" class="table_medium_col <?php 
        if ($order_by == 'order') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
                        spider_set_input_value('order_by', 'order');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'order' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'galleries_form')" href="">
              <span>Order</span><span class="sorting-indicator"></span>
            </a>
          </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, 'galleries_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';
                if ($row_data->preview_image == '') {
                    $preview_image = WD_BWG_URL . '/images/no-image.png';
                } else {
                    $preview_image = site_url() . '/' . $WD_BWG_UPLOAD_DIR . $row_data->preview_image;
                }
                ?>
              <tr id="tr_<?php 
                echo $row_data->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="connectedSortable table_small_col"><div title="Drag to re-order"class="handle" style="margin:5px auto 0 auto;"></div></td>
                <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_extra_large_col">
                  <img title="<?php 
                echo $row_data->name;
                ?>
" style="border: 1px solid #CCCCCC; max-width:60px; max-height:60px;" src="<?php 
                echo $preview_image . '?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, 'galleries_form')" href="" title="Edit"><?php 
                echo $row_data->name;
                ?>
</a></td>
                <td><?php 
                echo $row_data->slug;
                ?>
</td>
                <td><?php 
                echo get_userdata($row_data->author)->display_name;
                ?>
</td>
                <td class="spider_order table_medium_col"><input id="order_input_<?php 
                echo $row_data->id;
                ?>
" name="order_input_<?php 
                echo $row_data->id;
                ?>
" type="text" size="1" value="<?php 
                echo $row_data->order;
                ?>
" /></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, 'galleries_form')" href=""><img src="<?php 
                echo WD_BWG_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, 'galleries_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, 'galleries_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;
        ?>
" />
      <script>
        window.onload = spider_show_hide_weights;
      </script>
    </form>
    <?php 
    }
    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'])) : '';
        $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'])) : 'name';
        $image_id = isset($_GET['image_id']) ? esc_html($_GET['image_id']) : (isset($_POST['image_id']) ? esc_html($_POST['image_id']) : '0');
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $per_page = $this->model->per_page();
        $pager = 0;
        wp_print_scripts('jquery');
        wp_print_styles('admin-bar');
        wp_print_styles('wp-admin');
        wp_print_styles('dashicons');
        wp_print_styles('buttons');
        wp_print_styles('wp-auth-check');
        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_BWG_URL . '/css/bwg_tables.css?ver=' . wd_bwg_version();
        ?>
" id="bwg_tables-css" rel="stylesheet">
    <script src="<?php 
        echo WD_BWG_URL . '/js/bwg.js?ver=' . wd_bwg_version();
        ?>
" type="text/javascript"></script>
    <form class="wrap wp-core-ui bwg_form" id="tags_form" method="post" action="<?php 
        echo add_query_arg(array('action' => 'addTags', 'width' => '650', 'height' => '500', 'bwg_items_per_page' => $per_page, 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" style="width:99%; margin: 0 auto;">
      <?php 
        wp_nonce_field('addTags', 'bwg_nonce');
        ?>
      <h2 style="width:200px; float:left;"><?php 
        _e("Tags", 'bwg_back');
        ?>
</h2>
      <a href="" class="thickbox thickbox-preview" id="content-add_media" title="Add Tag" onclick="bwg_get_tags('<?php 
        echo $image_id;
        ?>
', event);" style="float:right; padding: 9px 0px 4px 0">
        <div class="wd-btn wd-btn-primary wd-btn-icon wd-btn-add" style="border:none;padding-top:8px !important;">ADD </div>
      </a>
      <div class="tablenav top">
        <?php 
        WDWLibrary::search(__('Name', 'bwg_back'), $search_value, 'tags_form', 'position_search');
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'tags_form', $per_page);
        ?>
      </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="sortable table_small_col <?php 
        if ($order_by == 'term_id') {
            echo $order_class;
        }
        ?>
" style="padding-left:15px">
            <a onclick="spider_set_input_value('order_by', 'term_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'])) == 'term_id' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'tags_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span></th>
            </a>
          <th class="sortable <?php 
        if ($order_by == 'name') {
            echo $order_class;
        }
        ?>
">
            <a onclick="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, 'tags_form')" href="">
              <span><?php 
        _e("Name", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="sortable <?php 
        if ($order_by == 'slug') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('order_by', 'slug');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'slug' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'tags_form')" href="">
              <span><?php 
        _e("Slug", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
        </thead>
        <tbody id="tbody_arr">
          <?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                ?>
              <tr id="tr_<?php 
                echo $row_data->term_id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column"><input id="check_<?php 
                echo $row_data->term_id;
                ?>
" name="check_<?php 
                echo $row_data->term_id;
                ?>
" type="checkbox" /></td>
                <td class="table_small_col"><?php 
                echo $row_data->term_id;
                ?>
</td>
                <td><a onclick="window.parent.bwg_add_tag('<?php 
                echo $image_id;
                ?>
', ['<?php 
                echo $row_data->term_id;
                ?>
'],['<?php 
                echo htmlspecialchars(addslashes($row_data->name));
                ?>
'])" id="a_<?php 
                echo $row_data->term_id;
                ?>
" style="cursor:pointer;"><?php 
                echo $row_data->name;
                ?>
</a></td> 
                <td id="slug_<?php 
                echo $row_data->term_id;
                ?>
"><?php 
                echo $row_data->slug ? $row_data->slug : '&nbsp;';
                ?>
</td> 
              </tr>
              <?php 
            }
        }
        ?>
        </tbody>
      </table>
      <div class="tablenav bottom">
        <?php 
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'tags_form', $per_page);
        ?>
      </div>
      <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;
        ?>
" />
      <input id="image_id" name="image_id" type="hidden" value="<?php 
        echo $image_id;
        ?>
" />
    </form>
    <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()
    {
        $album_id = isset($_GET['album_id']) ? esc_html(stripslashes($_GET['album_id'])) : (isset($_POST['album_id']) ? esc_html(stripslashes($_POST['album_id'])) : '');
        $rows_data = $this->model->get_rows_data($album_id);
        $page_nav = $this->model->page_nav($album_id);
        $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : '';
        $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'])) : 'name';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $per_page = $this->model->per_page();
        $pager = 0;
        wp_print_scripts('jquery');
        wp_print_scripts('wp-pointer');
        wp_print_styles('admin-bar');
        wp_print_styles('dashicons');
        wp_print_styles('wp-admin');
        wp_print_styles('buttons');
        wp_print_styles('wp-auth-check');
        wp_print_styles('wp-pointer');
        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_BWG_URL . '/css/bwg_tables.css?ver=' . wd_bwg_version();
        ?>
" id="spider_audio_player_tables-css" rel="stylesheet">
    <script src="<?php 
        echo WD_BWG_URL . '/js/bwg.js?ver=' . wd_bwg_version();
        ?>
" type="text/javascript"></script>
    <form class="wrap wp-core-ui bwg_form" id="albums_galleries_form" method="post" action="<?php 
        echo add_query_arg(array('action' => 'addAlbumsGalleries', 'width' => '700', 'height' => '550', 'callback' => 'bwg_add_items', 'bwg_items_per_page' => $per_page, 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" style="width:95%; margin: 0 auto;">
      <?php 
        wp_nonce_field('addAlbumsGalleries', 'bwg_nonce');
        ?>
      <h2 style="width:200px;float:left"><?php 
        _e("Albums/Galleries", 'bwg_back');
        ?>
</h2>
      <a href="" class="thickbox thickbox-preview" id="content-add_media" title="Add Album/Gallery" onclick="spider_get_items(event);" style="float:right; padding: 9px 0px 4px 0">
        <img id='add_albums' src="<?php 
        echo WD_BWG_URL . '/images/add_but.png';
        ?>
" style="border:none;" />
      </a>
      <div class="tablenav top">
        <?php 
        WDWLibrary::search(__("Name", 'bwg_back'), $search_value, 'albums_galleries_form');
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'albums_galleries_form', $per_page);
        ?>
      </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_small_col <?php 
        if ($order_by == 'id') {
            echo $order_class;
        }
        ?>
">
            <a onclick="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, 'albums_galleries_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="table_medium_col_uncenter <?php 
        if ($order_by == 'is_album') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
                        spider_set_input_value('order_by', 'is_album');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'is_album' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'albums_galleries_form')" href="">
              <span><?php 
        _e("Type", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="<?php 
        if ($order_by == 'name') {
            echo $order_class;
        }
        ?>
">
            <a onclick="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, 'albums_galleries_form')" href="">
              <span><?php 
        _e("Name", 'bwg_back');
        ?>
</span><span class="sorting-indicator"></span>
            </a>
          </th>          
        </thead>
        <tbody id="tbody_albums_galleries">
          <?php 
        if ($rows_data) {
            $iterator = 0;
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                ?>
              <tr id="tr_<?php 
                echo $iterator;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column"><input id="check_<?php 
                echo $iterator;
                ?>
" name="check_<?php 
                echo $iterator;
                ?>
" type="checkbox" /></td>
                <td id="id_<?php 
                echo $iterator;
                ?>
" class="table_small_col"><?php 
                echo $row_data->id;
                ?>
</td>
                <td id="url_<?php 
                echo $iterator;
                ?>
" class="table_medium_col_uncenter"><?php 
                echo $row_data->is_album ? __("Album", 'bwg_back') : __("Gallery", 'bwg_back');
                ?>
</td>
                <td>
                  <a onclick="window.parent.bwg_add_items(['<?php 
                echo $row_data->id;
                ?>
'],['<?php 
                echo htmlspecialchars(addslashes($row_data->name));
                ?>
'], ['<?php 
                echo htmlspecialchars(addslashes($row_data->is_album));
                ?>
'])" id="a_<?php 
                echo $iterator;
                ?>
" style="cursor:pointer;">
                    <?php 
                echo $row_data->name;
                ?>
                  </a>
                </td>
              </tr>
              <?php 
                $iterator++;
            }
        }
        ?>
        </tbody>
      </table>
      <div class="tablenav bottom">
        <?php 
        WDWLibrary::html_page_nav($page_nav['total'], $pager++, $page_nav['limit'], 'albums_galleries_form', $per_page);
        ?>
      </div>
      <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;
        ?>
" />
      <input id="album_id" name="album_id" type="hidden" value="<?php 
        echo $album_id;
        ?>
" />
    </form>
    <script src="<?php 
        echo get_admin_url();
        ?>
load-scripts.php?c=1&load%5B%5D=common,admin-bar" type="text/javascript"></script>
    <?php 
        include_once WD_BWG_DIR . '/includes/bwg_pointers.php';
        new BWG_pointers();
        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'])) : '';
        $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'])) : 'name';
        $image_id = isset($_GET['image_id']) ? esc_html($_GET['image_id']) : '0';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        ?>
    <link media="all" type="text/css" href="<?php 
        echo get_admin_url();
        ?>
load-styles.php?c=1&amp;dir=ltr&amp;load=admin-bar,wp-admin,dashicons,buttons,wp-auth-check" rel="stylesheet">
    <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">
    <link media="all" type="text/css" href="<?php 
        echo WD_BWG_URL . '/css/bwg_tables.css';
        ?>
" id="bwg_tables-css" rel="stylesheet">
    <script language="javascript" type="text/javascript" src="<?php 
        echo get_option("siteurl");
        ?>
/wp-includes/js/jquery/jquery.js"></script>
    <script src="<?php 
        echo WD_BWG_URL . '/js/bwg.js';
        ?>
" type="text/javascript"></script>
    <form class="wrap wp-core-ui" id="tags_form" method="post" action="<?php 
        echo add_query_arg(array('action' => 'addTags', 'width' => '650', 'height' => '500', 'TB_iframe' => '1'), admin_url('admin-ajax.php'));
        ?>
" style="width:95%; margin: 0 auto;">
      <h2 style="width:200px; float:left;">Tags</h2>
      <a href="" class="thickbox thickbox-preview" id="content-add_media" title="Add Tag" onclick="bwg_get_tags('<?php 
        echo $image_id;
        ?>
', event);" style="float:right; padding: 9px 0px 4px 0">
        <img src="<?php 
        echo WD_BWG_URL . '/images/add_but.png';
        ?>
" style="border:none;" />
      </a>
      <div class="tablenav top">
        <?php 
        WDWLibrary::search('Name', $search_value, 'tags_form');
        WDWLibrary::html_page_nav($page_nav['total'], $page_nav['limit'], 'tags_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" style="margin:0;" /></th>
          <th class="table_small_col <?php 
        if ($order_by == 'id') {
            echo $order_class;
        }
        ?>
">
            <a onclick="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, 'tags_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span></th>
            </a>
          <th class="<?php 
        if ($order_by == 'name') {
            echo $order_class;
        }
        ?>
">
            <a onclick="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, 'tags_form')" href="">
              <span>Name</span><span class="sorting-indicator"></span>
            </a>
          </th>
          <th class="<?php 
        if ($order_by == 'slug') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('order_by', 'slug');
                        spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'slug' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                        spider_form_submit(event, 'tags_form')" href="">
              <span>Slug</span><span class="sorting-indicator"></span>
            </a>
          </th>
        </thead>
        <tbody id="tbody_arr">
          <?php 
        if ($rows_data) {
            foreach ($rows_data as $row_data) {
                $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
                ?>
              <tr id="tr_<?php 
                echo $row_data->term_id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column"><input id="check_<?php 
                echo $row_data->term_id;
                ?>
" name="check_<?php 
                echo $row_data->term_id;
                ?>
" type="checkbox" /></td>
                <td class="table_small_col"><?php 
                echo $row_data->term_id;
                ?>
</td>
                <td><a onclick="window.parent.bwg_add_tag('<?php 
                echo $image_id;
                ?>
', ['<?php 
                echo $row_data->term_id;
                ?>
'],['<?php 
                echo htmlspecialchars(addslashes($row_data->name));
                ?>
'])" id="a_<?php 
                echo $row_data->term_id;
                ?>
" style="cursor:pointer;"><?php 
                echo $row_data->name;
                ?>
</a></td> 
                <td id="slug_<?php 
                echo $row_data->term_id;
                ?>
"><?php 
                echo $row_data->slug ? $row_data->slug : '&nbsp;';
                ?>
</td> 
              </tr>
              <?php 
            }
        }
        ?>
        </tbody>
      </table>
      <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>
    <script src="<?php 
        echo get_admin_url();
        ?>
load-scripts.php?c=1&load%5B%5D=common,admin-bar" type="text/javascript"></script>
    <?php 
        die;
    }