PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/broken-link-checker/includes/admin/search-form.php

https://bitbucket.org/lgorence/quickpress
PHP | 117 lines | 89 code | 14 blank | 14 comment | 16 complexity | 65b48df07d5c64a9af62df0591fd5842 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
  1. <?php
  2. $search_params = $current_filter['search_params'];
  3. ?>
  4. <div class="search-box">
  5. <?php
  6. //If we're currently displaying search results offer the user the option to
  7. //save the search query as a custom filter.
  8. if ( $filter_id == 'search' ){
  9. ?>
  10. <form name="save-search-query" id="custom-filter-form" action="<?php echo admin_url("tools.php?page=view-broken-links"); ?>" method="post" class="blc-inline-form">
  11. <?php wp_nonce_field('create-custom-filter'); ?>
  12. <input type="hidden" name="name" id="blc-custom-filter-name" value="" />
  13. <input type="hidden" name="params" id="blc-custom-filter-params" value="<?php echo http_build_query($search_params, null, '&'); ?>" />
  14. <input type="hidden" name="action" value="create-custom-filter" />
  15. <input type="button" value="<?php esc_attr_e( 'Save This Search As a Filter', 'broken-link-checker' ); ?>" id="blc-create-filter" class="button" />
  16. </form>
  17. <?php
  18. } elseif ( !empty($current_filter['custom']) ){
  19. //If we're displaying a custom filter give an option to delete it.
  20. ?>
  21. <form name="save-search-query" id="custom-filter-form" action="<?php echo admin_url("tools.php?page=view-broken-links"); ?>" method="post" class="blc-inline-form">
  22. <?php wp_nonce_field('delete-custom-filter'); ?>
  23. <input type="hidden" name="filter_id" id="blc-custom-filter-id" value="<?php echo $filter_id; ?>" />
  24. <input type="hidden" name="action" value="delete-custom-filter" />
  25. <input type="submit" value="<?php esc_attr_e( 'Delete This Filter', 'broken-link-checker' ); ?>" id="blc-delete-filter" class="button" />
  26. </form>
  27. <?php
  28. }
  29. ?>
  30. <input type="button" value="<?php esc_attr_e( 'Search', 'broken-link-checker' ); ?> &raquo;" id="blc-open-search-box" class="button" />
  31. </div>
  32. <!-- The search dialog -->
  33. <div id='search-links-dialog' title='Search'>
  34. <form class="search-form" action="<?php echo admin_url('tools.php?page=view-broken-links'); ?>" method="get">
  35. <input type="hidden" name="page" value="view-broken-links" />
  36. <input type="hidden" name="filter_id" value="search" />
  37. <fieldset>
  38. <label for="s_link_text"><?php _e('Link text', 'broken-link-checker'); ?></label>
  39. <input type="text" name="s_link_text" value="<?php if(!empty($search_params['s_link_text'])) echo esc_attr($search_params['s_link_text']); ?>" id="s_link_text" class="text ui-widget-content" />
  40. <label for="s_link_url"><?php _e('URL', 'broken-link-checker'); ?></label>
  41. <input type="text" name="s_link_url" id="s_link_url" value="<?php if(!empty($search_params['s_link_url'])) echo esc_attr($search_params['s_link_url']); ?>" class="text ui-widget-content" />
  42. <label for="s_http_code"><?php _e('HTTP code', 'broken-link-checker'); ?></label>
  43. <input type="text" name="s_http_code" id="s_http_code" value="<?php if(!empty($search_params['s_http_code'])) echo esc_attr($search_params['s_http_code']); ?>" class="text ui-widget-content" />
  44. <label for="s_filter"><?php _e('Link status', 'broken-link-checker'); ?></label>
  45. <select name="s_filter" id="s_filter">
  46. <?php
  47. if ( !empty($search_params['s_filter']) ){
  48. $search_subfilter = $search_params['s_filter'];
  49. } else {
  50. $search_subfilter = 'all';
  51. }
  52. $linkQuery = blcLinkQuery::getInstance();
  53. foreach ($linkQuery->native_filters as $filter => $data){
  54. $selected = ($search_subfilter == $filter)?' selected="selected"':'';
  55. printf('<option value="%s"%s>%s</option>', $filter, $selected, $data['name']);
  56. }
  57. ?>
  58. </select>
  59. <label for="s_link_type"><?php _e('Link type', 'broken-link-checker'); ?></label>
  60. <select name="s_link_type" id="s_link_type">
  61. <option value=""><?php _e('Any', 'broken-link-checker'); ?></option>
  62. <?php
  63. $moduleManager = blcModuleManager::getInstance();
  64. printf('<optgroup label="%s">', esc_attr(__('Links used in', 'broken-link-checker')));
  65. $containers = $moduleManager->get_modules_by_category('container', false, true);
  66. foreach($containers as $container_type => $module_data){
  67. if ( !empty($module_data['ModuleHidden']) || !$moduleManager->is_active($container_type) ){
  68. continue;
  69. }
  70. $selected = ( isset($search_params['s_link_type']) && $search_params['s_link_type'] == $container_type )?' selected="selected"':'';
  71. printf('<option value="%s"%s>%s</option>', $container_type, $selected, $module_data['Name']);
  72. }
  73. echo '</optgroup>';
  74. //TODO: Better group labels
  75. printf('<optgroup label="%s">', esc_attr(__('Link type', 'broken-link-checker')));
  76. $parsers = $moduleManager->get_modules_by_category('parser', false, true);
  77. foreach($parsers as $parser_type => $module_data){
  78. if ( !empty($module_data['ModuleHidden']) || !$moduleManager->is_active($parser_type) ){
  79. continue;
  80. }
  81. $selected = ( isset($search_params['s_link_type']) && $search_params['s_link_type'] == $parser_type )?' selected="selected"':'';
  82. printf('<option value="%s"%s>%s</option>', $parser_type, $selected, $module_data['Name']);
  83. }
  84. echo '</optgroup>';
  85. /*
  86. $link_types = array(
  87. __('Any', 'broken-link-checker') => '',
  88. __('Normal link', 'broken-link-checker') => 'link',
  89. __('Image', 'broken-link-checker') => 'image',
  90. __('Custom field', 'broken-link-checker') => 'custom_field',
  91. __('Bookmark', 'broken-link-checker') => 'blogroll',
  92. __('Comment', 'broken-link-checker') => 'comment',
  93. );
  94. */
  95. ?>
  96. </select>
  97. </fieldset>
  98. <div id="blc-search-button-row">
  99. <input type="submit" value="<?php esc_attr_e( 'Search Links', 'broken-link-checker' ); ?>" id="blc-search-button" name="search_button" class="button-primary" />
  100. <input type="button" value="<?php esc_attr_e( 'Cancel', 'broken-link-checker' ); ?>" id="blc-cancel-search" class="button" />
  101. </div>
  102. </form>
  103. </div>