Ejemplo n.º 1
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']) && $_POST['asc_or_desc'] == 'desc' ? 'desc' : 'asc';
        $order_by_array = array('id', 'title', 'mail');
        $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to create, edit forms.
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form onkeypress="fm_doNothing(event)" class="wrap" id="manage_form" method="post" action="admin.php?page=manage_fm" style="float: left; width: 99%;">
      <?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
      <span class="form_maker_icon"></span>
      <h2>
        Form Maker
        <a href="" class="add-new-h2" onclick="fm_set_input_value('task', 'add');
                                               fm_form_submit(event, 'manage_form')">Add new</a>
      </h2>
      <div class="tablenav top">
        <?php 
        WDW_FM_Library::search('Title', $search_value, 'manage_form');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'manage_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="fm_set_input_value('task', '');
              fm_set_input_value('order_by', 'id');
              fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
              fm_form_submit(event, 'manage_form')" href="">
              <span>ID</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="<?php 
        if ($order_by == 'title') {
            echo $order_class;
        }
        ?>
">
            <a onclick="fm_set_input_value('task', '');
              fm_set_input_value('order_by', 'title');
              fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'title' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
              fm_form_submit(event, 'manage_form')" href="">
              <span>Title</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="<?php 
        if ($order_by == 'mail') {
            echo $order_class;
        }
        ?>
">
            <a onclick="fm_set_input_value('task', '');
              fm_set_input_value('order_by', 'mail');
              fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'mail' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
              fm_form_submit(event, 'manage_form')" href="">
              <span>Email to send submissions to</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="table_big_col">Shortcode</th>
          <th class="table_large_col">PHP function</th>
          <th class="table_big_col">Edit</th>
          <th class="table_big_col"><a title="Delete selected items" href="" onclick="if (confirm('Do you want to delete selected items?')) {
                                                       fm_set_input_value('task', 'delete_all');
                                                       fm_form_submit(event, 'manage_form');
                                                     } else {
                                                       return false;
                                                     }">Delete</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"';
                $old = '';
                if (isset($row_data->form) && $row_data->form != '') {
                    $old = '_old';
                }
                ?>
              <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="fm_set_input_value('task', 'edit<?php 
                echo $old;
                ?>
');
                              fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              fm_form_submit(event, 'manage_form')" href="" title="Edit"><?php 
                echo $row_data->title;
                ?>
</a>
                </td>
                <td><?php 
                echo $row_data->mail;
                ?>
</td>
                <td class="table_big_col" style="padding-left: 0; padding-right: 0;">
                  <input type="text" value='[Form id="<?php 
                echo $row_data->id;
                ?>
"]' onclick="fm_select_value(this)" size="12" readonly="readonly" style="padding-left: 1px; padding-right: 1px;"/>
                </td>
                <td class="table_large_col" style="padding-left: 0; padding-right: 0;">
                  <input type="text" value='&#60;?php wd_form_maker(<?php 
                echo $row_data->id;
                ?>
); ?&#62;' onclick="fm_select_value(this)"  readonly="readonly" style="padding-left: 1px; padding-right: 1px;"/>
                </td>
                <td class="table_big_col">
                  <a onclick="fm_set_input_value('task', 'edit<?php 
                echo $old;
                ?>
');
                              fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
');
                              fm_form_submit(event, 'manage_form')" href="">Edit</a>
                </td>
                <td class="table_big_col">
                  <a onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete');
                    fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'manage_form'); } else { return false; }" 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 
    }
Ejemplo n.º 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(stripslashes($_POST['search_value'])) : '';
        $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'desc';
        $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div id="fm_blocked_ips_message" style="width: 99%; display: none;"></div>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to block IPs.
        <a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form onkeypress="spider_doNothing(event)" class="wrap" id="blocked_ips" method="post" action="admin.php?page=blocked_ips_fm" style="float: left; width: 99%;">
      <?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
      <span class="block_icon"></span>
      <h2>Blocked IPs</h2>
      <div class="buttons_div">
        <input class="button-primary" type="submit" value="Save" onclick="spider_set_input_value('task', 'save_all');" />
        <input class="button-secondary" type="submit" value="Delete" onclick="if (confirm('Do you want to unblock selected IPs?')) {
                                                                      spider_set_input_value('task', 'delete_all');
                                                                    } else {
                                                                      return false;
                                                                    }" />
      </div>
      <div class="tablenav top">
        <?php 
        WDW_FM_Library::search('IP', $search_value, 'blocked_ips');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'blocked_ips');
        ?>
      </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 == '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, 'blocked_ips')" href="">
                <span>ID</span><span class="sorting-indicator"></span></th>
              </a>
            <th class="<?php 
        if ($order_by == 'ip') {
            echo $order_class;
        }
        ?>
">
              <a onclick="spider_set_input_value('task', '');
                          spider_set_input_value('order_by', 'ip');
                          spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) == 'ip' && esc_html(stripslashes($_POST['asc_or_desc'])) == 'asc' ? 'desc' : 'asc';
        ?>
');
                          spider_form_submit(event, 'blocked_ips')" href="">
                <span>IP</span><span class="sorting-indicator"></span>
              </a>
            </th>
            <th class="table_big_col">Edit</th>
            <th class="table_big_col">Delete</th>
          </tr>		  
          <tr id="tr">
            <th></th>
            <th></th>
            <th class="edit_input"><input type="text" class="input_th" id="ip" name="ip" onkeypress="return spider_check_isnum(event)"></th>
            <th class="table_big_col">
              <a class="add_tag_th button-primary button button-small" onclick="if (spider_check_required('ip', 'IP')) {return false;}
                                                                                spider_set_input_value('task', 'save');
                                                                                spider_set_input_value('current_id', '');
                                                                                spider_form_submit(event, 'blocked_ips')" href="">Add IP</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->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
                <td class="table_small_col check-column" id="td_check_<?php 
                echo $row_data->id;
                ?>
" >
                  <input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox" />
                </td>
                <td class="table_small_col" id="td_id_<?php 
                echo $row_data->id;
                ?>
" ><?php 
                echo $row_data->id;
                ?>
</td>
                <td id="td_ip_<?php 
                echo $row_data->id;
                ?>
" >
                  <a class="pointer" id="ip<?php 
                echo $row_data->id;
                ?>
"
                     onclick="spider_edit_ip(<?php 
                echo $row_data->id;
                ?>
)" 
                     title="Edit"><?php 
                echo $row_data->ip;
                ?>
</a>
                </td>
                <td class="table_big_col" id="td_edit_<?php 
                echo $row_data->id;
                ?>
">
                  <a onclick="spider_edit_ip(<?php 
                echo $row_data->id;
                ?>
)">Edit</a>
                </td>
                <td class="table_big_col" id="td_delete_<?php 
                echo $row_data->id;
                ?>
">
                  <a onclick="spider_set_input_value('task', 'delete');
                              spider_set_input_value('current_id', <?php 
                echo $row_data->id;
                ?>
);
                              spider_form_submit(event, 'blocked_ips')" 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="<?php 
        echo $asc_or_desc;
        ?>
" />
      <input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
" />
    </form>
    <?php 
    }
Ejemplo n.º 3
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']) && $_POST['asc_or_desc'] == 'desc' ? 'desc' : 'asc';
        $order_by_array = array('id', 'title', 'default');
        $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
    <div class="fm-user-manual">
		This section allows you to create, edit form themes.
		<a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
	</div>
	<div class="fm-upgrade-pro">
		<a target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
			<div class="fm-upgrade-img">
				UPGRADE TO PRO VERSION 
				<span></span>
			</div>
		</a>
	</div>
	<div class="fm-clear"></div>
    <form class="wrap" id="themes_form" method="post" action="admin.php?page=themes_fm" style="width:99%;">
		<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
		<div class="fm-page-banner themes-banner">
			<div class="theme_icon">
			</div>
			<div class="fm-logo-title">Themes</div>
			<button class="fm-button add-button medium" style="margin-left: 31px;" onclick="fm_set_input_value('task', 'add'); fm_form_submit(event, 'themes_form');">
				<span></span>
				Add New
			</button>
			<div class="fm-page-actions">
				<button class="fm-button delete-button small" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete_all'); } else { return false; }">
					<span></span>
					Delete
				</button>
			</div>
		</div>	
		<div class="fm-clear"></div>		
		<div class="tablenav top">
			<?php 
        WDW_FM_Library::search('Title', $search_value, 'themes_form');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'themes_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="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'id'); fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
'); fm_form_submit(event, 'themes_form')" href="">
					<span>ID</span><span class="sorting-indicator"></span></a>
				</th>
				<th class="<?php 
        if ($order_by == 'title') {
            echo $order_class;
        }
        ?>
">
					<a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'title'); fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'title' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
'); fm_form_submit(event, 'themes_form')" href="">
					<span>Title</span><span class="sorting-indicator"></span></a>
				</th>
				<th class="table_big_col <?php 
        if ($order_by == 'default') {
            echo $order_class;
        }
        ?>
">
					<a onclick="fm_set_input_value('task', ''); fm_set_input_value('order_by', 'default'); fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'default' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
'); fm_form_submit(event, 'themes_form')" href="">
					<span>Default</span><span class="sorting-indicator"></span></a>
				</th>
				<th class="table_small_col">Edit</th>
				<th class="table_small_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 ? 'default' : 'notdefault';
                $default = $row_data->default ? '' : '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="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'themes_form')" href="" title="Edit"><?php 
                echo $row_data->title;
                ?>
</a>
							</td>
							<td class="table_big_col">
								<?php 
                if ($default != '') {
                    ?>
									<a onclick="fm_set_input_value('task', '<?php 
                    echo $default;
                    ?>
'); fm_set_input_value('current_id', '<?php 
                    echo $row_data->id;
                    ?>
'); fm_form_submit(event, 'themes_form')" href="">
								<?php 
                }
                ?>
									<img src="<?php 
                echo WD_FM_URL . '/images/' . $default_image . '.png?ver=' . get_option("wd_form_maker_version") . '';
                ?>
" />
								<?php 
                if ($default != '') {
                    ?>
									</a>
								<?php 
                }
                ?>
							</td>
							<td class="table_small_col">
								<button class="fm-icon edit-icon" onclick="fm_set_input_value('task', 'edit'); fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'themes_form');">
									<span></span>
								</button>
							</td>
							<td class="table_small_col">
								<button class="fm-icon delete-icon" onclick="if (confirm('Do you want to delete selected item(s)?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id', '<?php 
                echo $row_data->id;
                ?>
'); fm_form_submit(event, 'themes_form'); } else {return false;}">
									<span></span>
								</button>
							</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($_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 = '';
        ?>
    <div style="clear: both; float: left; width: 99%;">
      <div style="float:left; font-size: 14px; font-weight: bold;">
        This section allows you to edit form themes.
        <a style="color: blue; text-decoration: none;" target="_blank" href="http://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
      </div>
      <div style="float: right; text-align: right;">
        <a style="text-decoration: none;" target="_blank" href="http://web-dorado.com/files/fromFormMaker.php">
          <img width="215" border="0" alt="web-dorado.com" src="<?php 
        echo WD_FM_URL . '/images/wd_logo.png';
        ?>
" />
        </a>
      </div>
    </div>
    <form class="wrap" id="themes_form" method="post" action="admin.php?page=themes_fm" style="float: left; width: 99%;">
      <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 
        WDW_FM_Library::search('Title', $search_value, 'themes_form');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'themes_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('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 == 'title') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
              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($_POST['order_by']) == 'title' && esc_html($_POST['asc_or_desc']) == 'asc' ? 'desc' : 'asc';
        ?>
');
              spider_form_submit(event, 'themes_form')" href="">
              <span>Title</span><span class="sorting-indicator"></span></a>
          </th>
          <th class="table_big_col <?php 
        if ($order_by == 'default') {
            echo $order_class;
        }
        ?>
">
            <a onclick="spider_set_input_value('task', '');
              spider_set_input_value('order_by', 'default');
              spider_set_input_value('asc_or_desc', '<?php 
        echo isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && esc_html($_POST['order_by']) == 'default' && 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 ? 'default' : 'notdefault';
                $default = $row_data->default ? '' : '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->title;
                ?>
</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_FM_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']) && $_POST['asc_or_desc'] == 'desc' ? 'desc' : 'asc';
        $order_by_array = array('id', 'ip');
        $order_by = isset($_POST['order_by']) && in_array(esc_html(stripslashes($_POST['order_by'])), $order_by_array) ? esc_html(stripslashes($_POST['order_by'])) : 'id';
        $order_class = 'manage-column column-title sorted ' . $asc_or_desc;
        $ids_string = '';
        ?>
		<div id="fm_blocked_ips_message" style="width: 99%; display: none;"></div>
		<div class="fm-user-manual">
			This section allows you to block IPs.
			<a style="color: blue; text-decoration: none;" target="_blank" href="https://web-dorado.com/wordpress-form-maker-guide-2.html">Read More in User Manual</a>
		</div>
		<div class="fm-upgrade-pro">
			<a target="_blank" href="https://web-dorado.com/files/fromFormMaker.php">
				<div class="fm-upgrade-img">
					UPGRADE TO PRO VERSION 
					<span></span>
				</div>
			</a>
		</div>
		<div class="fm-clear"></div>
		<form onkeypress="fm_doNothing(event)" class="wrap" id="blocked_ips" method="post" action="admin.php?page=blocked_ips_fm" style="width:99%;">
			<?php 
        wp_nonce_field('nonce_fm', 'nonce_fm');
        ?>
			<div class="fm-page-banner blocked-ips-banner">
				<div class="block_icon">
				</div>
				<div class="fm-logo-title">Blocked IPs</div>
				<div class="fm-page-actions">
					<button class="fm-button save-button small" onclick="fm_set_input_value('task', 'save_all');">
						<span></span>
						Save
					</button>
					<button class="fm-button delete-button small" onclick="if (confirm('Do you want to unblock selected IPs?')) { fm_set_input_value('task', 'delete_all'); } else { return false; }">
						<span></span>
						Delete
					</button>
				</div>
			</div>	 
			<div class="fm-clear"></div>
			<div class="tablenav top">
				<?php 
        WDW_FM_Library::search('IP', $search_value, 'blocked_ips');
        WDW_FM_Library::html_page_nav($page_nav['total'], $page_nav['limit'], 'blocked_ips');
        ?>
			</div>
			<table class="wp-list-table widefat fixed pages fm-block-ip">
				<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 == 'id') {
            echo $order_class;
        }
        ?>
">
							<a onclick="fm_set_input_value('task', '');
                          fm_set_input_value('order_by', 'id');
                          fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'id' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
                          fm_form_submit(event, 'blocked_ips')" href="">
								<span>ID</span><span class="sorting-indicator"></span></th>
							</a>
						<th class="<?php 
        if ($order_by == 'ip') {
            echo $order_class;
        }
        ?>
">
							<a onclick="fm_set_input_value('task', '');
                          fm_set_input_value('order_by', 'ip');
                          fm_set_input_value('asc_or_desc', '<?php 
        echo $order_by == 'ip' && $asc_or_desc == 'asc' ? 'desc' : 'asc';
        ?>
');
                          fm_form_submit(event, 'blocked_ips')" href="">
							<span>IP</span><span class="sorting-indicator"></span>
							</a>
						</th>
						<th class="table_small_col">Edit</th>
						<th class="table_small_col">Delete</th>
					</tr>		  
					<tr id="tr" style="background-color: #f9f9f9;">
						<th></th>
						<th></th>
						<th>
							<input type="text" class="input_th" id="ip" name="ip" onkeypress="return fm_check_isnum(event)">
							<button class="fm-button add-button small" onclick="if (fm_check_required('ip', 'IP')) {return false;} fm_set_input_value('task', 'save'); fm_set_input_value('current_id', ''); fm_save_ip('blocked_ips');">
								Add IP
								<span></span>
							</button>
						</th>
						<th>
							
						</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->id;
                ?>
" <?php 
                echo $alternate;
                ?>
>
						<td class="table_small_col check-column" id="td_check_<?php 
                echo $row_data->id;
                ?>
" >
								<input id="check_<?php 
                echo $row_data->id;
                ?>
" name="check_<?php 
                echo $row_data->id;
                ?>
" type="checkbox" />
							</td>
							<td class="table_small_col" id="td_id_<?php 
                echo $row_data->id;
                ?>
" ><?php 
                echo $row_data->id;
                ?>
</td>
							<td id="td_ip_<?php 
                echo $row_data->id;
                ?>
" >
								<a class="pointer" id="ip<?php 
                echo $row_data->id;
                ?>
"
							 onclick="fm_edit_ip(<?php 
                echo $row_data->id;
                ?>
)" 
							 title="Edit"><?php 
                echo $row_data->ip;
                ?>
</a>
							</td>
							<td class="table_small_col" id="td_edit_<?php 
                echo $row_data->id;
                ?>
">
								<button class="fm-icon edit-icon" onclick="fm_edit_ip(<?php 
                echo $row_data->id;
                ?>
);">
									<span></span>
								</button>
							</td>
							<td class="table_small_col" id="td_delete_<?php 
                echo $row_data->id;
                ?>
">
								<button class="fm-icon delete-icon" onclick="if (confirm('Do you want to unblock selected IP?')) { fm_set_input_value('task', 'delete'); fm_set_input_value('current_id', <?php 
                echo $row_data->id;
                ?>
); fm_form_submit(event, 'blocked_ips'); } else {return false;}">
									<span></span>
								</button>
							</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="<?php 
        echo $asc_or_desc;
        ?>
" />
		<input id="order_by" name="order_by" type="hidden" value="<?php 
        echo $order_by;
        ?>
" />
    </form>
    <?php 
    }