Advertisement
Guest User

Untitled

a guest
May 11th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Loader)
  6. *
  7. * @ Version : 2.0.0.4
  8. * @ Author : DeZender
  9. * @ Release on : 21.10.2015
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class sfrAdvancedPages extends WP_Widget {
  15.  
  16. public function __construct() {
  17.  
  18. parent::__construct("sfrAdvancedPages", "- SAFİR - GELİŞMİŞ SAYFALAR", array("description" => "İstediğiniz sayfaları göstermek için kullanılabilecek bileşen"));
  19. add_action("save_post", array($this, "delete_widget_cache"));
  20. add_action("deleted_post", array($this, "delete_widget_cache"));
  21. add_action("switch_theme", array($this, "delete_widget_cache"));
  22. return;
  23. }
  24.  
  25. public function delete_widget_cache() {
  26.  
  27. delete_transient($this->id);
  28. return;
  29. }
  30.  
  31. private function get_defaults() {
  32.  
  33. $defaults = array("title" => "SAYFALAR", "color" => "mavi", "icon" => "sayfa", "slogan" => "Buraya başlık altındaki kısa açıklamanızı girebilirsiniz.", "scroll" => "scroll", "detail" => "evet", "buttonText" => "SAYFAYA GİT");
  34. return $defaults;
  35. }
  36.  
  37. public function update($new_instance, $old_instance) {
  38.  
  39. $instance = $old_instance;
  40. $instance["title"] = $new_instance["title"];
  41. $instance["pageIDs"] = $new_instance["pageIDs"];
  42. $instance["slogan"] = $new_instance["slogan"];
  43. $instance["color"] = $new_instance["color"];
  44. $instance["number"] = $new_instance["number"];
  45. $instance["offset"] = $new_instance["offset"];
  46. $instance["color"] = $new_instance["color"];
  47. $instance["icon"] = $new_instance["icon"];
  48. $instance["filter"] = $new_instance["filter"];
  49. $instance["categoryChoice"] = $new_instance["categoryChoice"];
  50. $instance["catIDs"] = $new_instance["catIDs"];
  51. $instance["scroll"] = $new_instance["scroll"];
  52. $instance["buttonText"] = $new_instance["buttonText"];
  53. $instance["detail"] = $new_instance["detail"];
  54. $this->delete_widget_cache();
  55. return $instance;
  56. }
  57.  
  58. public function form($instance) {
  59.  
  60. $defaults = $this->get_defaults();
  61. extract(wp_parse_args($instance, $defaults));
  62. echo " <p>\r
  63. <label for=\"";
  64. echo $this->get_field_id("title");
  65. echo "\">Bileşen başlığı</label>\r
  66. <input type=\"text\" id=\"";
  67. echo $this->get_field_id("title");
  68. echo "\" name=\"";
  69. echo $this->get_field_name("title");
  70. echo "\" value=\"";
  71. echo esc_attr($title);
  72. echo "\" class=\"widefat\" />\r
  73. </p>\r
  74. <p> \r
  75. <label for=\"";
  76. echo $this->get_field_id("slogan");
  77. echo "\">Başlık altındaki açıklama<br/>(sadece anasayfa için)</label>\r
  78. <input type=\"text\" id=\"";
  79. echo $this->get_field_id("slogan");
  80. echo "\" name=\"";
  81. echo $this->get_field_name("slogan");
  82. echo "\" value=\"";
  83. echo esc_attr($slogan);
  84. echo "\" class=\"widefat\" />\r
  85. </p>\r
  86. <div class=\"safirCategoryGroup\"> \r
  87. <p>\r
  88. Hangi sayfalar gösterilsin?\r
  89. </p> \r
  90. <p style=\"height:123px;overflow-y:scroll; border:1px solid #e2e2e2; padding:0 5px;margin:-1em -1px 1em 1px\">\r
  91. ";
  92. $counter = 0;
  93. $args = array("sort_order" => "ASC", "sort_column" => "post_title", "hierarchical" => 1, "exclude" => "", "include" => "", "meta_key" => "", "meta_value" => "", "authors" => "", "child_of" => 0, "parent" => -1, "exclude_tree" => "", "number" => "", "offset" => 0, "post_type" => "page", "post_status" => "publish");
  94. $globalPages = get_pages($args);
  95. global $globalCategories;
  96. foreach ($globalPages as $globalPage)
  97. {
  98. echo " <label style=\"display:block;margin-top:5px;\" for=\"";
  99. echo $this->get_field_name("pageIDs");
  100. echo $counter;
  101. echo "\">\r
  102. <input id=\"";
  103. echo $this->get_field_name("pageIDs");
  104. echo $counter;
  105. echo "\" name=\"";
  106. echo $this->get_field_name("pageIDs");
  107. echo "[]\" type=\"checkbox\" value=\"";
  108. echo $globalPage->ID;
  109. echo "\"";
  110. if (is_array($pageIDs) || in_array($globalPage["ID"], $pageIDs))
  111. {
  112. echo " checked";
  113. }
  114. echo "> ";
  115. echo $globalPage->post_title;
  116. echo "</label>\r
  117. ";
  118. ++$counter;
  119. continue;
  120. }
  121. echo " </p>\r
  122. </div>\r
  123. <p>\r
  124. <label for=\"";
  125. echo $this->get_field_id("filter");
  126. echo ">\">Sayfalar neye göre gösterilsin?</label>\r
  127. <select style=\"width:100%;\" id=\"";
  128. echo $this->get_field_id("filter");
  129. echo "\" name=\"";
  130. echo $this->get_field_name("filter");
  131. echo "\">\r
  132. <option value=\"date\"";
  133. if ("date" == esc_attr($filter))
  134. {
  135. echo " selected";
  136. }
  137. echo ">Son eklenene göre</option>\r
  138. <option value=\"hit\"";
  139. if ("hit" == esc_attr($filter))
  140. {
  141. echo " selected";
  142. }
  143. echo ">En çok bakılana göre</option>\r
  144. <option value=\"comment_count\"";
  145. if ("comment_count" == esc_attr($filter))
  146. {
  147. echo " selected";
  148. ........................................
  149. .........................
  150. ........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement