/wp-content/plugins/list-category-posts/lcp_widget_form.php

https://gitlab.com/endomorphosis/reservationtelco · PHP · 126 lines · 101 code · 9 blank · 16 comment · 10 complexity · 2ee846b86d1741fceb089268d476e2fe MD5 · raw file

  1. <?php
  2. /* Copyright 2008-2010 Fernando Briano (email : fernando@picandocodigo.net)
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  14. */
  15. $instance = wp_parse_args( (array) $instance, array( 'title' => '',
  16. 'categoryid' => '',
  17. 'limit' => '',
  18. 'orderby'=>'',
  19. 'order'=>'',
  20. 'date'=>'',
  21. 'author'=>'',
  22. 'excerpt'=>'',
  23. 'exclude'=>'',
  24. 'excludeposts'=>'',
  25. 'offset'=>'',
  26. 'catlink'=>'' ) );
  27. $title = strip_tags($instance['title']);
  28. $limit = strip_tags($instance['limit']);
  29. $orderby = strip_tags($instance['orderby']);
  30. $order = strip_tags($instance['order']);
  31. $date = strip_tags($instance['date']);
  32. $author = strip_tags($instance['author']);
  33. $exclude = strip_tags($instance['exclude']);
  34. $excludeposts = strip_tags($instance['excludeposts']);
  35. $offset = strip_tags($instance['offset']);
  36. $catlink = strip_tags($instance['catlink']);
  37. $categoryid = strip_tags($instance['categoryid']);
  38. ?>
  39. <?php //var_dump($instance);?>
  40. <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <br/>
  41. <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
  42. name="<?php echo $this->get_field_name('title'); ?>" type="text"
  43. value="<?php echo attribute_escape($title); ?>" />
  44. </label></p>
  45. <p><label for="<?php echo $this->get_field_id('categoryid'); ?>">Category: <br/>
  46. <select id="<?php echo $this->get_field_id('categoryid'); ?>" name="<?php echo $this->get_field_name('categoryid'); ?>">
  47. <?php
  48. $categories= get_categories();
  49. foreach ($categories as $cat) :
  50. $option = '<option value="' . $cat->cat_ID;
  51. if ($cat->cat_ID == attribute_escape($categoryid)) :
  52. $option .= ' selected = "selected" ';
  53. endif;
  54. $option .= '">';
  55. $option .= $cat->cat_name;
  56. $option .= '</option>';
  57. echo $option;
  58. endforeach;
  59. ?>
  60. </select></p>
  61. <p><label for="<?php echo $this->get_field_id('limit'); ?>">Number of posts: <br/>
  62. <input size="2" id="<?php echo $this->get_field_id('limit'); ?>"
  63. name="<?php echo $this->get_field_name('limit'); ?>" type="text"
  64. value="<?php echo attribute_escape($limit); ?>" />
  65. </label></p>
  66. <p><label for="<?php echo $this->get_field_id('offset'); ?>">Offset: <br/>
  67. <input size="2" id="<?php echo $this->get_field_id('offset'); ?>"
  68. name="<?php echo $this->get_field_name('offset'); ?>" type="text"
  69. value="<?php echo attribute_escape($offset); ?>" />
  70. </label></p>
  71. <p><label for="<?php echo $this->get_field_id('order'); ?>">Order: <br/>
  72. <select id="<?php echo $this->get_field_id('orderby'); ?>"
  73. name="<?php echo $this->get_field_name('orderby'); ?>" type="text" />
  74. <option value='date'>Date</option>
  75. <option value='title'>Post title</option>
  76. <option value='author'>Author</option>
  77. <option value='rand'>Random</option>
  78. </select></p>
  79. <p><label for="<?php echo $this->get_field_id('order'); ?>">Order: <br/>
  80. <select id="<?php echo $this->get_field_id('order'); ?>"
  81. name="<?php echo $this->get_field_name('order'); ?>" type="text" />
  82. <option value='desc'>Descending</option>
  83. <option value='asc'>Ascending</option>
  84. </select></p>
  85. <p><label for="<?php echo $this->get_field_id('exclude'); ?>">Exclude categories (id's): <br/>
  86. <input id="<?php echo $this->get_field_id('exclude'); ?>"
  87. name="<?php echo $this->get_field_name('exclude'); ?>" type="text"
  88. value="<?php echo attribute_escape($exclude); ?>" />
  89. </label></p>
  90. <p><label for="<?php echo $this->get_field_id('excludeposts'); ?>">Exclude posts (id's): <br/>
  91. <input id="<?php echo $this->get_field_id('excludeposts'); ?>"
  92. name="<?php echo $this->get_field_name('excludeposts'); ?>" type="text"
  93. value="<?php echo attribute_escape($excludeposts); ?>" />
  94. </label></p>
  95. <p>
  96. <label>Show: </label><br/>
  97. <input type="radio"
  98. <?php if ($date == 'on' ) : echo ' checked = "checked" '; endif; ?>
  99. name="<?php echo $this->get_field_name('date'); ?>"
  100. value="<?php echo attribute_escape($date); ?>">Date<br>
  101. <input type="radio"
  102. <?php if ($author == 'on' ) : echo ' checked = "checked" '; endif; ?>
  103. name="<?php echo $this->get_field_name('author'); ?>"
  104. value="<?php echo attribute_escape($author); ?>">Author<br>
  105. <input type="radio"
  106. <?php if ($catlink == 'on' ) : echo ' checked = "checked" '; endif; ?>
  107. name="<?php echo $this->get_field_name('catlink'); ?>"
  108. value="<?php echo attribute_escape($catlink); ?>">Link to category<br>
  109. <input type="radio"
  110. <?php if ($excerpt == 'on' ) : echo ' checked = "checked" '; endif; ?>
  111. name="<?php echo $this->get_field_name('excerpt'); ?>"
  112. value="<?php echo attribute_escape($excerpt); ?>">Excerpt<br>
  113. </p>