Advertisement
LaurentiuITK

function.php

Jun 30th, 2021 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 41.33 KB | None | 0 0
  1. <?php
  2. /*
  3.  * @ Discord : PlayersMu#1991
  4.  * @ Decoder version : 0.0.0.1
  5.  */
  6.  
  7. add_action("init", "lisans");
  8. include "functions-ek.php";
  9. include get_template_directory() . "/birbot/birbot.config.php";
  10. add_action("after_switch_theme", "birtema_aktivasyon");
  11. add_action("init", "bb_ust_menu_register");
  12. add_theme_support("post-thumbnails");
  13. if (function_exists("add_image_size")) {
  14.     add_image_size("anasayfa_manset", 728, 468, true);
  15.     add_image_size("anasayfa_manset_2", 728, 440, true);
  16.     add_image_size("icerik_resim", 728, 440, true);
  17.     add_image_size("anasayfa_manset_alt", 116, 78, true);
  18.     add_image_size("anasayfa_mobil_manset", 275, 240, true);
  19.     add_image_size("anasayfa_yan_manset", 300, 190, true);
  20.     add_image_size("anasayfa_yan_manset_alt", 118, 80, true);
  21.     add_image_size("anasayfa_bilesen", 242, 162, true);
  22.     add_image_size("anasayfa_kategori_bilesen_ilk", 485, 428, true);
  23.     add_image_size("anasayfa_kategori_bilesen_resim", 243, 163, true);
  24.     add_image_size("anasayfa_icerik_bilesen_ilk", 598, 394, true);
  25.     add_image_size("anasayfa_icerik_bilesen_iki", 446, 192, true);
  26.     add_image_size("anasayfa_icerik_bilesen_thumb", 142, 96, true);
  27.     add_image_size("ilgili_icerik", 159, 96, true);
  28.     add_image_size("kategori_icerik", 226, 152, true);
  29. }
  30. add_theme_support("title-tag");
  31. show_admin_bar(false);
  32. add_action("wp_ajax_delete_message", "delete_message");
  33. add_action("wp_ajax_readed_message", "readed_message");
  34. require_once get_template_directory() . "/cs/codestar-framework.php";
  35. require_once get_template_directory() . "/inc/metabox/metabox.php";
  36. require_once get_template_directory() . "/inc/post-like.php";
  37. require_once get_template_directory() . "/inc/shortcode/shortcode.php";
  38. $bp_options = get_option("birbahis");
  39. register_sidebar(["name" => "Ana Sayfa (Üst)", "description" => "Buraya sadece Anasayfa (Üst) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  40. register_sidebar(["name" => "Ana Sayfa (Content)", "description" => "Buraya sadece Anasayfa (Content) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  41. register_sidebar(["name" => "Ana Sayfa (Üst Sidebar)", "description" => "Buraya sadece Anasayfa (Üst Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  42. register_sidebar(["name" => "Ana Sayfa (Manşet)", "description" => "Buraya sadece Anasayfa (Manşet) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  43. register_sidebar(["name" => "Ana Sayfa (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  44. register_sidebar(["name" => "Kategori (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  45. register_sidebar(["name" => "Ana Sayfa (Single)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  46. register_sidebar(["name" => "Ana Sayfa (Mobil - Üst)", "description" => "Buraya sadece (Anasayfa) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  47. register_sidebar(["name" => "Ana Sayfa (Mobil - Alt)", "description" => "Buraya sadece (Anasayfa) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  48. register_sidebar(["name" => "İddaa Toplist (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  49. register_sidebar(["name" => "Alt Üst (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  50. register_sidebar(["name" => "Avrupa Top 10 (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  51. register_sidebar(["name" => "Bilgisayar Tahminleri (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  52. register_sidebar(["name" => "Değerli Oranlar (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  53. register_sidebar(["name" => "Dünkü Maç Sonuçları (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  54. register_sidebar(["name" => "Oranı Düşen Maçlar (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  55. register_sidebar(["name" => "Tahmin (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  56. register_sidebar(["name" => "Arama (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  57. register_sidebar(["name" => "Üye Sayfası (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  58. register_sidebar(["name" => "Canlı Sonuçlar (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  59. register_sidebar(["name" => "Fikstür (Sidebar)", "description" => "Buraya sadece (Sidebar) yazan bileşenleri eklemelisiniz.", "before_widget" => "", "after_widget" => "", "before_title" => "", "after_title" => ""]);
  60. add_action("wp", "update_online_users_status");
  61. if (!is_user_logged_in()) {
  62.     add_action("init", "ajax_auth_init");
  63. }
  64. add_action("wp_ajax_nopriv_sunset_check_pagedNews", "sunset_check_pagedNews");
  65. add_action("wp_ajax_sunset_check_pagedNews", "sunset_check_pagedNews");
  66. add_action("wp_ajax_nopriv_sunset_load_moreNews", "sunset_load_moreNews");
  67. add_action("wp_ajax_sunset_load_moreNews", "sunset_load_moreNews");
  68. add_action("wp_ajax_nopriv_sunset_load_moreNewsMobile", "sunset_load_moreNewsMobile");
  69. add_action("wp_ajax_sunset_load_moreNewsMobile", "sunset_load_moreNewsMobile");
  70. add_action("wp_ajax_nopriv_sunset_load_moreAuthor", "sunset_load_moreAuthor");
  71. add_action("wp_ajax_sunset_load_moreAuthor", "sunset_load_moreAuthor");
  72. add_action("wp_ajax_iletisim", "iletisim");
  73. add_action("wp_ajax_nopriv_iletisim", "iletisim");
  74. add_action("wp_ajax_confirm_kupon", "confirm_kupon");
  75. add_action("wp_ajax_vip_kupon", "vip_kupon");
  76. add_action("wp_ajax_status_kupon", "status_kupon");
  77. add_action("wp_ajax_delete_kupon", "delete_kupon");
  78. add_action("wp_ajax_live_chat", "live_chat");
  79. add_action("wp_ajax_nopriv_live_chat", "live_chat");
  80. add_action("wp_ajax_get_live_chat", "get_live_chat");
  81. add_action("wp_ajax_nopriv_get_live_chat", "get_live_chat");
  82. add_action("wp_ajax_delete_live_chat", "delete_live_chat");
  83. add_action("wp_ajax_read_live_chat", "read_live_chat");
  84. add_action("show_user_profile", "my_user_profile_edit_action");
  85. add_action("edit_user_profile", "my_user_profile_edit_action");
  86. add_action("personal_options_update", "my_user_profile_update_action");
  87. add_action("edit_user_profile_update", "my_user_profile_update_action");
  88. add_action("init", "checkAccessed");
  89. add_filter("cron_schedules", "isa_add_every_three_minutes");
  90. if (!wp_next_scheduled("isa_add_every_three_minutes")) {
  91.     wp_schedule_event(time(), "every_three_minutes", "isa_add_every_three_minutes");
  92. }
  93. add_action("isa_add_every_three_minutes", "data_cron");
  94. function lisans()
  95. {
  96.     include "lisans.php";
  97.     $domain = $_SERVER["HTTP_HOST"];
  98.     $domain = str_replace("www.", "", $domain);
  99.     $random = "3seas#fc0F6MRzgos3182";
  100.     $h = "" . $random . "_" . $domain . "";
  101.     $hash = md5($h);
  102.     if ($hash != $lisans) {
  103.         if ($hash != $lisans2) {
  104.             if ($hash != $lisans3) {
  105.                 if ($hash != $lisans4) {
  106.                     if ($hash != $lisans5) {
  107.                         echo "Bu Tema Lisanssızdır. Lisansını almak için [email protected] mail adresinden iletişime geçebilirsiniz.";
  108.                         exit;
  109.                     }
  110.                 }
  111.             }
  112.         }
  113.     }
  114. }
  115. function birtema_aktivasyon()
  116. {
  117.     add_option("birbahis_versiyon", "1.0");
  118.     require_once ABSPATH . "wp-admin/includes/upgrade.php";
  119.     $sql3 = "CREATE TABLE `bt_follower` (\n  `system_id` int(11) NOT NULL,\n  `user_id` int(11) NOT NULL,\n  `follow_id` int(11) NOT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
  120.     dbDelta($sql3);
  121.     dbDelta("ALTER TABLE `bt_follower` ADD PRIMARY KEY (`system_id`);");
  122.     dbDelta("ALTER TABLE `bt_follower` MODIFY `system_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;");
  123.     $sql = "CREATE TABLE `bt_contact` (\n  `contact_id` int(11) NOT NULL,\n  `name` varchar(255) NOT NULL,\n  `email` varchar(255) NOT NULL,\n  `subject` varchar(255) NOT NULL,\n  `message` longtext NOT NULL,\n  `time` int(11) NOT NULL,\n  `status` int(11) NOT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
  124.     dbDelta($sql);
  125.     dbDelta("ALTER TABLE `bt_contact` ADD PRIMARY KEY (`contact_id`);");
  126.     dbDelta("ALTER TABLE `bt_contact` MODIFY `contact_id` int(11);");
  127.     $sql2 = "CREATE TABLE `bt_live_chat` (\n          `id` int(11) NOT NULL,\n          `page_id` varchar(255) NOT NULL,\n          `name` varchar(255) NOT NULL,\n          `text` mediumtext NOT NULL,\n          `status` int(11) NOT NULL,\n          `time` int(11) NOT NULL\n        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n        ALTER TABLE `bt_live_chat`\n          ADD PRIMARY KEY (`id`);\n        ALTER TABLE `bt_live_chat`\n          MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;\n        COMMIT;";
  128.     dbDelta($sql2);
  129.     dbDelta("CREATE TABLE `bt_odd` (\n  `odd_id` int(11) NOT NULL,\n  `user_id` int(11) NOT NULL,\n  `data` json NOT NULL,\n  `time` int(11) NOT NULL,\n  `confirm` int(11) NOT NULL,\n  `win` int(11) NOT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\nALTER TABLE `bt_odd`\n  ADD PRIMARY KEY (`odd_id`);\n\nALTER TABLE `bt_odd`\n  MODIFY `odd_id` int(11) NOT NULL AUTO_INCREMENT;");
  130. }
  131. function bb_ust_menu_register()
  132. {
  133.     register_nav_menus(["bbUstMenu" => __("Üst Menu", "theme_prefix")]);
  134.     register_nav_menus(["bbMobileMenu1" => __("Mobil Menu 1", "theme_prefix"), "bbMobileMenu2" => __("Mobil Menu 2", "theme_prefix"), "bbMobileMenu3" => __("Mobil Menu 3", "theme_prefix")]);
  135.     register_nav_menus(["bbFooter1" => __("Footer Menü 1", "theme_prefix"), "bbFooter2" => __("Footer Menü 2", "theme_prefix"), "bbFooter3" => __("Footer Menü 3", "theme_prefix"), "bbFooter4" => __("Footer Menü 4", "theme_prefix"), "bbFooter5" => __("Footer Menü 5", "theme_prefix"), "bbFooter6" => __("Footer Menü 6", "theme_prefix")]);
  136. }
  137. function bf_recent_post($limit)
  138. {
  139.     $args = ["numberposts" => $limit, "offset" => 0, "orderby" => "post_date", "order" => "DESC", "include" => "", "exclude" => "", "meta_key" => "", "meta_value" => "", "post_type" => "post", "post_status" => "publish", "suppress_filters" => true];
  140.     $recent_posts = wp_get_recent_posts($args, ARRAY_A);
  141.     return $recent_posts;
  142. }
  143. function getPostViews($postID)
  144. {
  145.     $count_key = "post_views_count";
  146.     $count = get_post_meta($postID, $count_key, true);
  147.     if ($count == "") {
  148.         delete_post_meta($postID, $count_key);
  149.         add_post_meta($postID, $count_key, "0");
  150.         return "0 View";
  151.     }
  152.     return $count . " Views";
  153. }
  154. function setPostViews($postID)
  155. {
  156.     $count_key = "post_views_count";
  157.     $count = get_post_meta($postID, $count_key, true);
  158.     if ($count == "") {
  159.         $count = 0;
  160.         delete_post_meta($postID, $count_key);
  161.         add_post_meta($postID, $count_key, "0");
  162.     } else {
  163.         $count++;
  164.         update_post_meta($postID, $count_key, $count);
  165.     }
  166. }
  167. function delete_message()
  168. {
  169.     if (is_admin()) {
  170.         global $wpdb;
  171.         $id = $_POST["contact_id"];
  172.         $wpdb->delete("bt_contact", ["contact_id" => $id]);
  173.         echo "Ok";
  174.         wp_die();
  175.     }
  176. }
  177. function readed_message()
  178. {
  179.     if (is_admin()) {
  180.         global $wpdb;
  181.         $id = $_POST["contact_id"];
  182.         $wpdb->update("bt_contact", ["status" => "0"], ["contact_id" => $id], ["%s"], ["%d"]);
  183.         echo "Ok";
  184.         wp_die();
  185.     }
  186. }
  187. function kategori_listele($post_id)
  188. {
  189.     $category_ids = wp_get_post_categories($post_id);
  190.     $kategori_list = [];
  191.     foreach ($category_ids as $key => $val) {
  192.         $category_parent = get_category($category_ids[$key])->category_parent;
  193.         if ($category_parent != 0 && !$kategori_list[0]) {
  194.             $kategori_list[0] = $val;
  195.         }
  196.         if ($kategori_list[0]) {
  197.             $category_parent = get_category($kategori_list[0])->category_parent;
  198.             $kategori_list[1] = $category_parent;
  199.         }
  200.     }
  201.     if (count($category_ids) == 1 || empty($kategori_list[1])) {
  202.         $kategori_list[1] = $category_ids[0];
  203.     }
  204.     return $kategori_list;
  205. }
  206. function sinyor_comment($comment, $args, $depth)
  207. {
  208.     $GLOBALS["comment"] = $comment;
  209.     $PostAuthor = false;
  210.     if ($comment->comment_author_email == get_the_author_email()) {
  211.         $PostAuthor = true;
  212.     } else {
  213.         if ($comment->comment_author_email == "") {
  214.             $PostAuthor = true;
  215.         }
  216.     }
  217.     echo "\n<div class=\"comment ";
  218.     if ($PostAuthor) {
  219.         echo "authorcomment";
  220.     }
  221.     echo "\" id=\"li-yorum-";
  222.     comment_ID();
  223.     echo "\">\n\t<div class=\"avatar\">";
  224.     echo get_avatar($comment, $size = "66");
  225.     echo "</div>\n\t\t<div class=\"right\">\n\t\t\t<ul>\n\t\t\t\t<li>\n\t\t\t\t<div class=\"left\"><span class=\"commentAuthor\">";
  226.     comment_author();
  227.     echo "</span><span class=\"time\">";
  228.     echo human_time_diff(get_comment_time("U"), current_time("timestamp")) . " önce";
  229.     echo "</span></div>\n\t\t\t\t<div class=\"reply\">";
  230.     comment_reply_link(array_merge($args, ["depth" => $depth, "max_depth" => $args["max_depth"]]));
  231.     echo "</div>\n\t\t\t\t</li>\n\t\t\t\t<li><p>";
  232.     comment_text();
  233.     echo "</p></li>\n\n\t\t";
  234.     if ("0" == $comment->comment_approved) {
  235.         echo "\t\t<div class=\"yorumOnay\">* Yorumunuz onay bekliyor.</div>\n\t\t<script type=\"text/javascript\">\n\t\t  setTimeout('Redirect()','1000');\n\t\t  function Redirect()\n\t\t  {\n\t\t\t\$('html, body').animate({\n\t\t\t\tscrollTop: \$('#li-yorum-";
  236.         comment_ID();
  237.         echo "').offset().top\n\t\t\t}, 1000);\n\t\t\treturn false;\n\t\t  }\n\t\t</script>\n\t\t ";
  238.     }
  239.     echo "\t\t\t</ul>\n\t\t</div>\n</div>\n\n";
  240. }
  241. function get_snippet($str, $wordCount = 10)
  242. {
  243.     $summary = strip_tags(implode("", array_slice(preg_split("/([\\s,\\.;\\?\\!]+)/", $str, $wordCount * 2 + 1, PREG_SPLIT_DELIM_CAPTURE), 0, $wordCount * 2 - 1)));
  244.     preg_match_all("@\\[(.*?)\\]@si", $summary, $shortcode_regex);
  245.     return str_replace($shortcode_regex[0], NULL, $summary);
  246. }
  247. function get_category_options()
  248. {
  249.     $categories = get_categories(["orderby" => "name", "order" => "ASC"]);
  250.     foreach ($categories as $category) {
  251.         $category_data[$category->term_id] = $category->name;
  252.     }
  253.     return $category_data;
  254. }
  255. function permalink($str, $options = [])
  256. {
  257.     $str = mb_convert_encoding((int) $str, "UTF-8", mb_list_encodings());
  258.     $defaults = ["delimiter" => "-", "limit" => NULL, "lowercase" => true, "replacements" => [], "transliterate" => true];
  259.     $options = array_merge($defaults, $options);
  260.     $char_map = ["À" => "A", "Á" => "A", "Â" => "A", "Ã" => "A", "Ä" => "A", "Å" => "A", "Æ" => "AE", "Ç" => "C", "È" => "E", "É" => "E", "Ê" => "E", "Ë" => "E", "Ì" => "I", "Í" => "I", "Î" => "I", "Ï" => "I", "Ð" => "D", "Ñ" => "N", "Ò" => "O", "Ó" => "o", "Ô" => "O", "Õ" => "O", "Ö" => "O", "Ő" => "O", "Ø" => "O", "Ù" => "U", "Ú" => "U", "Û" => "U", "Ü" => "U", "Ű" => "U", "Ý" => "Y", "Þ" => "TH", "ß" => "ss", "à" => "a", "á" => "a", "â" => "a", "ã" => "a", "ä" => "a", "å" => "a", "æ" => "ae", "ç" => "c", "è" => "e", "é" => "e", "ê" => "e", "ë" => "e", "ì" => "i", "í" => "i", "î" => "i", "ï" => "i", "ð" => "d", "ñ" => "n", "ò" => "o", "ó" => "o", "ô" => "o", "õ" => "o", "ö" => "o", "ő" => "o", "ø" => "o", "ù" => "u", "ú" => "u", "û" => "u", "ü" => "u", "ű" => "u", "ý" => "y", "þ" => "th", "ÿ" => "y", "©" => "(c)", "Α" => "A", "Β" => "B", "Γ" => "G", "Δ" => "D", "Ε" => "E", "Ζ" => "Z", "Η" => "H", "Θ" => "8", "Ι" => "I", "Κ" => "K", "Λ" => "L", "Μ" => "M", "Ν" => "N", "Ξ" => "3", "Ο" => "O", "Π" => "P", "Ρ" => "R", "Σ" => "S", "Τ" => "T", "Υ" => "Y", "Φ" => "F", "Χ" => "X", "Ψ" => "PS", "Ω" => "W", "Ά" => "A", "Έ" => "E", "Ί" => "I", "Ό" => "O", "Ύ" => "Y", "Ή" => "H", "Ώ" => "W", "Ϊ" => "I", "Ϋ" => "Y", "α" => "a", "β" => "b", "γ" => "g", "δ" => "d", "ε" => "e", "ζ" => "z", "η" => "h", "θ" => "8", "ι" => "i", "κ" => "k", "λ" => "l", "μ" => "m", "ν" => "n", "ξ" => "3", "ο" => "o", "π" => "p", "ρ" => "r", "σ" => "s", "τ" => "t", "υ" => "y", "φ" => "f", "χ" => "x", "ψ" => "ps", "ω" => "w", "ά" => "a", "έ" => "e", "ί" => "i", "ό" => "o", "ύ" => "y", "ή" => "h", "ώ" => "w", "ς" => "s", "ϊ" => "i", "ΰ" => "y", "ϋ" => "y", "ΐ" => "i", "Ş" => "S", "İ" => "I", "Ğ" => "G", "ş" => "s", "ı" => "i", "ğ" => "g", "А" => "A", "Б" => "B", "В" => "V", "Г" => "G", "Д" => "D", "Е" => "E", "Ё" => "Yo", "Ж" => "Zh", "З" => "Z", "И" => "I", "Й" => "J", "К" => "K", "Л" => "L", "М" => "M", "Н" => "N", "О" => "O", "П" => "P", "Р" => "R", "С" => "S", "Т" => "T", "У" => "U", "Ф" => "F", "Х" => "H", "Ц" => "C", "Ч" => "Ch", "Ш" => "Sh", "Щ" => "Sh", "Ъ" => "", "Ы" => "Y", "Ь" => "", "Э" => "E", "Ю" => "Yu", "Я" => "Ya", "а" => "a", "б" => "b", "в" => "v", "г" => "g", "д" => "d", "е" => "e", "ё" => "yo", "ж" => "zh", "з" => "z", "и" => "i", "й" => "j", "к" => "k", "л" => "l", "м" => "m", "н" => "n", "о" => "o", "п" => "p", "р" => "r", "с" => "s", "т" => "t", "у" => "u", "ф" => "f", "х" => "h", "ц" => "c", "ч" => "ch", "ш" => "sh", "щ" => "sh", "ъ" => "", "ы" => "y", "ь" => "", "э" => "e", "ю" => "yu", "я" => "ya", "Є" => "Ye", "І" => "I", "Ї" => "Yi", "Ґ" => "G", "є" => "ye", "і" => "i", "ї" => "yi", "ґ" => "g", "Č" => "C", "Ď" => "D", "Ě" => "E", "Ň" => "N", "Ř" => "R", "Š" => "S", "Ť" => "T", "Ů" => "U", "Ž" => "Z", "č" => "c", "ď" => "d", "ě" => "e", "ň" => "n", "ř" => "r", "š" => "s", "ť" => "t", "ů" => "u", "ž" => "z", "Ą" => "A", "Ć" => "C", "Ę" => "e", "Ł" => "L", "Ń" => "N", "Ś" => "S", "Ź" => "Z", "Ż" => "Z", "ą" => "a", "ć" => "c", "ę" => "e", "ł" => "l", "ń" => "n", "ś" => "s", "ź" => "z", "ż" => "z", "Ā" => "A", "Ē" => "E", "Ģ" => "G", "Ī" => "i", "Ķ" => "k", "Ļ" => "L", "Ņ" => "N", "Ū" => "u", "ā" => "a", "ē" => "e", "ģ" => "g", "ī" => "i", "ķ" => "k", "ļ" => "l", "ņ" => "n", "ū" => "u"];
  261.     $str = preg_replace(array_keys($options["replacements"]), $options["replacements"], $str);
  262.     if ($options["transliterate"]) {
  263.         $str = str_replace(array_keys($char_map), $char_map, $str);
  264.     }
  265.     $str = preg_replace("/[^\\p{L}\\p{Nd}]+/u", $options["delimiter"], $str);
  266.     $str = preg_replace("/(" . preg_quote($options["delimiter"], "/") . "){2,}/", "\$1", $str);
  267.     $str = mb_substr($str, 0, $options["limit"] ? $options["limit"] : mb_strlen($str, "UTF-8"), "UTF-8");
  268.     $str = trim($str, $options["delimiter"]);
  269.     return $options["lowercase"] ? mb_strtolower($str, "UTF-8") : $str;
  270. }
  271. function month_eng_to_tr($str)
  272. {
  273.     $ing_aylar = ["January", "February", "March", "May", "April", "June", "July", "August", "September", "October", "November", "December"];
  274.     $tr_aylar = ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"];
  275.     return str_replace($ing_aylar, $tr_aylar, $str);
  276. }
  277. function month_perma_to_text($str)
  278. {
  279.     $ing_aylar = ["January", "February", "March", "May", "April", "June", "July", "August", "September", "October", "November", "December"];
  280.     $tr_aylar = ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"];
  281.     return str_replace($ing_aylar, $tr_aylar, $str);
  282. }
  283. function jpegImgCrop($target_url)
  284. {
  285.     $image = imagecreatefromjpeg($target_url);
  286.     $filename = $target_url;
  287.     $width = imagesx($image);
  288.     $height = imagesy($image);
  289.     $image_type = imagetypes($image);
  290.     if ($width == $height) {
  291.         $thumb_width = $width;
  292.         $thumb_height = $height;
  293.     } else {
  294.         if ($width < $height) {
  295.             $thumb_width = $width;
  296.             $thumb_height = $width;
  297.         } else {
  298.             if ($height < $width) {
  299.                 $thumb_width = $height;
  300.                 $thumb_height = $height;
  301.             } else {
  302.                 $thumb_width = 150;
  303.                 $thumb_height = 150;
  304.             }
  305.         }
  306.     }
  307.     $original_aspect = $width / $height;
  308.     $thumb_aspect = $thumb_width / $thumb_height;
  309.     if ($thumb_aspect <= $original_aspect) {
  310.         $new_height = $thumb_height;
  311.         $new_width = $width / ($height / $thumb_height);
  312.     } else {
  313.         $new_width = $thumb_width;
  314.         $new_height = $height / ($width / $thumb_width);
  315.     }
  316.     $thumb = imagecreatetruecolor($thumb_width, $thumb_height);
  317.     imagecopyresampled($thumb, $image, 0 - ($new_width - $thumb_width) / 2, 0 - ($new_height - $thumb_height) / 2, 0, 0, $new_width, $new_height, $width, $height);
  318.     imagejpeg($thumb, $filename, 80);
  319. }
  320. function get_user_role($id)
  321. {
  322.     $user = new WP_User($id);
  323.     return array_shift($user->roles);
  324. }
  325. function update_online_users_status()
  326. {
  327.     if (is_user_logged_in()) {
  328.         if (($logged_in_users = get_transient("users_online")) === false) {
  329.             $logged_in_users = [];
  330.         }
  331.         $current_user = wp_get_current_user();
  332.         $current_user = $current_user->ID;
  333.         $current_time = current_time("timestamp");
  334.         if (!isset($logged_in_users[$current_user]) || $logged_in_users[$current_user] < $current_time - 900) {
  335.             $logged_in_users[$current_user] = $current_time;
  336.             set_transient("users_online", $logged_in_users, 1800);
  337.         }
  338.     }
  339. }
  340. function is_user_online($user_id)
  341. {
  342.     $logged_in_users = get_transient("users_online");
  343.     return isset($logged_in_users[$user_id]) && current_time("timestamp") - 900 < $logged_in_users[$user_id];
  344. }
  345. function auth_user_login($user_login, $password, $login)
  346. {
  347.     $info = [];
  348.     $info["user_login"] = $user_login;
  349.     $info["user_password"] = $password;
  350.     $info["remember"] = true;
  351.     $user_signon = wp_signon($info, "");
  352.     if (is_wp_error($user_signon)) {
  353.         echo json_encode(["loggedin" => false, "message" => __("Kullanıcı adı veya şifre yanlış.")]);
  354.     } else {
  355.         wp_set_current_user($user_signon->ID);
  356.         echo json_encode(["loggedin" => true, "message" => __("Giriş başarılı, yönlendiriliyorsunuz...")]);
  357.     }
  358.     exit;
  359. }
  360. function ajax_auth_init()
  361. {
  362.     wp_register_script("validate-script", get_template_directory_uri() . "/js/jquery.validate.js", ["jquery"]);
  363.     wp_enqueue_script("validate-script");
  364.     wp_register_script("ajax-auth-script", get_template_directory_uri() . "/js/ajax-auth-script.js", ["jquery"]);
  365.     wp_enqueue_script("ajax-auth-script");
  366.     wp_localize_script("ajax-auth-script", "ajax_auth_object", ["ajaxurl" => admin_url("admin-ajax.php"), "redirecturl" => home_url(), "loadingmessage" => __("Bilgiler gönderiliyor, lütfen bekleyin...")]);
  367.     add_action("wp_ajax_nopriv_ajaxlogin", "ajax_login");
  368.     add_action("wp_ajax_nopriv_ajaxregister", "ajax_register");
  369. }
  370. function ajax_login()
  371. {
  372.     check_ajax_referer("ajax-login-nonce", "security");
  373.     auth_user_login($_POST["username"], $_POST["password"], "Login");
  374.     exit;
  375. }
  376. function ajax_register()
  377. {
  378.     check_ajax_referer("ajax-register-nonce", "security");
  379.     $info = [];
  380.     $info["user_login"] = sanitize_user($_POST["username"]);
  381.     $info["first_name"] = $info["user_login"];
  382.     $info["display_name"] = $info["first_name"];
  383.     $info["nickname"] = $info["display_name"];
  384.     $info["user_nicename"] = $info["nickname"];
  385.     $info["user_pass"] = sanitize_text_field($_POST["password"]);
  386.     $info["user_email"] = sanitize_email($_POST["email"]);
  387.     $user_register = wp_insert_user($info);
  388.     if (is_wp_error($user_register)) {
  389.         $error = $user_register->get_error_codes();
  390.         if (in_array("empty_user_login", $error)) {
  391.             echo json_encode(["loggedin" => false, "message" => __($user_register->get_error_message("empty_user_login"))]);
  392.         } else {
  393.             if (in_array("existing_user_login", $error)) {
  394.                 echo json_encode(["loggedin" => false, "message" => __("Bu kullanıcı adı kullanılıyor.")]);
  395.             } else {
  396.                 if (in_array("existing_user_email", $error)) {
  397.                     echo json_encode(["loggedin" => false, "message" => __("Bu e-mail adresi kullanılıyor.")]);
  398.                 }
  399.             }
  400.         }
  401.     } else {
  402.         auth_user_login($info["nickname"], $info["user_pass"], "Registration");
  403.     }
  404.     exit;
  405. }
  406. function sunset_check_pagedNews($num = NULL)
  407. {
  408.     $output = "";
  409.     if (is_paged()) {
  410.         $output = "page/" . get_query_var("paged");
  411.     }
  412.     if ($num == 1) {
  413.         $paged = get_query_var("paged") == 0 ? 1 : get_query_var("paged");
  414.         return $paged;
  415.     }
  416.     return $output;
  417. }
  418. function sunset_load_moreNews()
  419. {
  420.     $paged = $_POST["page"] + 1;
  421.     $prev = $_POST["prev"];
  422.     $catID = $_POST["cat"];
  423.     if ($prev == 1 && $_POST["page"] != 1) {
  424.         $paged = $_POST["page"] - 1;
  425.     }
  426.     $query = new WP_Query(["post_status" => "publish", "paged" => $paged, "category__in" => $catID, "posts_per_page" => 15, "ignore_sticky_posts" => "-1", "order" => "desc"]);
  427.     if ($query->have_posts()) {
  428.         while ($query->have_posts()) {
  429.             $query->the_post();
  430.             $current_id = get_the_ID();
  431.             $category_ids = kategori_listele($current_id);
  432.             echo "<div class=\"post\" data-page=\"" . $paged . "\">";
  433.             echo "                    <div class=\"thumb\"><a href=\"";
  434.             the_permalink();
  435.             echo "\">";
  436.             the_post_thumbnail("kategori_icerik", ["alt" => get_the_title()]);
  437.             echo "</a></div>\n                    <a href=\"";
  438.             the_permalink();
  439.             echo "\" class=\"title\">";
  440.             echo the_title();
  441.             echo "</a>\n                  </div>\n\n\t";
  442.         }
  443.     } else {
  444.         echo 0;
  445.     }
  446.     wp_reset_postdata();
  447.     exit;
  448. }
  449. function sunset_load_moreNewsMobile()
  450. {
  451.     $paged = $_POST["page"] + 1;
  452.     $prev = $_POST["prev"];
  453.     $catID = $_POST["cat"];
  454.     if ($prev == 1 && $_POST["page"] != 1) {
  455.         $paged = $_POST["page"] - 1;
  456.     }
  457.     $query = new WP_Query(["post_status" => "publish", "paged" => $paged, "category__in" => $catID, "posts_per_page" => 16, "ignore_sticky_posts" => "-1", "order" => "desc"]);
  458.     if ($query->have_posts()) {
  459.         while ($query->have_posts()) {
  460.             $query->the_post();
  461.             $current_id = get_the_ID();
  462.             $category_ids = kategori_listele($current_id);
  463.             echo "<div class=\"post\" data-page=\"" . $paged . "\">";
  464.             echo "                    <div class=\"thumb\"><a href=\"";
  465.             the_permalink();
  466.             echo "\">";
  467.             the_post_thumbnail("kategori_icerik", ["alt" => get_the_title()]);
  468.             echo "</a></div>\n                    <a href=\"";
  469.             the_permalink();
  470.             echo "\" class=\"title\">";
  471.             echo the_title();
  472.             echo "</a>\n                  </div>\n\n\t";
  473.         }
  474.     } else {
  475.         echo 0;
  476.     }
  477.     wp_reset_postdata();
  478.     exit;
  479. }
  480. function sunset_load_moreAuthor()
  481. {
  482.     $paged = $_POST["page"] + 1;
  483.     $prev = $_POST["prev"];
  484.     $authorIn = $_POST["author"];
  485.     if ($prev == 1 && $_POST["page"] != 1) {
  486.         $paged = $_POST["page"] - 1;
  487.     }
  488.     $query = new WP_Query(["post_status" => "publish", "paged" => $paged, "author" => $authorIn, "posts_per_page" => "12"]);
  489.     if ($query->have_posts()) {
  490.         while ($query->have_posts()) {
  491.             $query->the_post();
  492.             $current_id = get_the_ID();
  493.             $category_ids = kategori_listele($current_id);
  494.             echo "<div class=\"post\" data-page=\"/page/" . $paged . "\">";
  495.             echo "<div class=\"thumb\"><a href=\"";
  496.             the_permalink();
  497.             echo "\">";
  498.             the_post_thumbnail("icerik_image", ["alt" => get_the_title()]);
  499.             echo "</a></div>\n<a href=\"";
  500.             the_permalink();
  501.             echo "\" class=\"title\">";
  502.             the_title();
  503.             echo "</a>\n</div>\n";
  504.         }
  505.     } else {
  506.         echo 0;
  507.     }
  508.     wp_reset_postdata();
  509.     exit;
  510. }
  511. function sunset_check_pagedAuthor($num = NULL)
  512. {
  513.     $output = "";
  514.     if (is_paged()) {
  515.         $output = "page/" . get_query_var("paged");
  516.     }
  517.     if ($num == 1) {
  518.         $paged = get_query_var("paged") == 0 ? 1 : get_query_var("paged");
  519.         return $paged;
  520.     }
  521.     return $output;
  522. }
  523. function security_post($data)
  524. {
  525.     return htmlspecialchars(trim($data));
  526. }
  527. function iletisim()
  528. {
  529.     global $wpdb;
  530.     $wpdb->insert("bt_contact", ["name" => security_post($_POST["name"]), "email" => security_post($_POST["email"]), "subject" => security_post($_POST["subject"]), "message" => security_post($_POST["message"]), "time" => time(), "status" => 1]);
  531.     echo "Ok";
  532.     wp_die();
  533. }
  534. function confirm_kupon($coupon_id)
  535. {
  536.     if (is_admin()) {
  537.         global $wpdb;
  538.         $id = $_POST["id"];
  539.         $wpdb->update("bt_odd", ["confirm" => "1"], ["odd_id" => $id], ["%s"], ["%d"]);
  540.         echo "Ok";
  541.         wp_die();
  542.     }
  543. }
  544. function vip_kupon($coupon_id)
  545. {
  546.     if (is_admin()) {
  547.         global $wpdb;
  548.         $id = $_POST["id"];
  549.         $wpdb->update("bt_odd", ["confirm" => "2"], ["odd_id" => $id], ["%s"], ["%d"]);
  550.         echo "Ok";
  551.         wp_die();
  552.     }
  553. }
  554. function status_kupon($coupon_id)
  555. {
  556.     if (is_admin()) {
  557.         global $wpdb;
  558.         $id = $_POST["id"];
  559.         $status = $_POST["status"];
  560.         $wpdb->update("bt_odd", ["status" => $status], ["odd_id" => $id], ["%s"], ["%d"]);
  561.         echo "Ok";
  562.         wp_die();
  563.     }
  564. }
  565. function delete_kupon()
  566. {
  567.     if (is_admin()) {
  568.         global $wpdb;
  569.         $id = $_POST["id"];
  570.         $wpdb->delete("bt_odd", ["odd_id" => $id]);
  571.         echo "Ok";
  572.         wp_die();
  573.     }
  574. }
  575. function live_chat()
  576. {
  577.     global $wpdb;
  578.     global $bp_options;
  579.     $page_id = $_POST["page_id"];
  580.     $name = $_POST["name"];
  581.     $comment = $_POST["comment"];
  582.     $kufurArray = explode(",", $bp_options["kufurText"]);
  583.     $wpdb->insert("bt_live_chat", ["page_id" => security_post($page_id), "name" => security_post($name), "text" => security_post($comment), "status" => 1, "time" => time()]);
  584.     $data_id = $wpdb->insert_id;
  585.     echo "<div class=\"comment authorcomment newChat_" . $_POST["random_key"] . "\" style=\"border: 1px solid rgb(219, 223, 228);\" data-id=\"" . $data_id . "\">\n  <div class=\"right\" style=\"width: calc(100% - 10px); padding-left: 10px;padding-right: 15px;padding-top:10px;padding-bottom:10px;\">\n  <ul>\n  <li><span class=\"social-avatar\">" . mb_strtoupper(mb_substr($name, 0, 1, "UTF-8")) . "</span><div class=\"left\" style=\"margin-top: 3px;\">\n  <span class=\"commentAuthor\" style=\"color: #0f7c39;\">@" . $name . "</span>\n  <span class=\"time\" style=\"font-weight: 400;\">Şimdi</span></div>\n  </li><li style=\"font-weight: 500;word-wrap:break-word;position:relative; bottom: 5px;\">\n  <p>" . str_replace($kufurArray, "***", $comment) . "</p></li></ul></div></div>";
  586.     wp_die();
  587. }
  588. function get_live_chat()
  589. {
  590.     global $wpdb;
  591.     global $bp_options;
  592.     $kufurArray = explode(",", $bp_options["kufurText"]);
  593.     $page_id = $_POST["page_id"];
  594.     $json_return = [];
  595.     $live_chat = $wpdb->get_results("SELECT * FROM bt_live_chat WHERE page_id = '" . $page_id . "' ORDER BY id");
  596.     foreach ($live_chat as $key => $value) {
  597.         echo "  ";
  598.         $json_return[$value->id]["html"] = "<div class=\"comment authorcomment\" style=\"border: 1px solid #dbdfe4;\" data-id=\"" . $value->id . "\"><div class=\"right\" style=\"width: calc(100% - 10px); padding-left: 15px;padding-right: 15px;padding-top:10px;padding-bottom:10px;\">\n    <ul style=\"height:auto!important;\">\n      <li style=\"height: auto;\">\n        <span class=\"social-avatar\">" . mb_strtoupper(mb_substr($value->name, 0, 1), "UTF-8") . "</span>\n        <div class=\"left\"><span class=\"commentAuthor\" style=\"color: #0f7c39;\">@" . $value->name . "</span><span class=\"time\" style=\"font-weight: 400;\">" . timeConvert(date("Y-m-d H:i:s", $value->time)) . "</span></div>\n      </li>\n      <li style=\"padding:0 5px;font-weight: 500;word-wrap:break-word;height: auto;\"><p>" . str_replace($kufurArray, "***", strip_tags(html_entity_decode($value->text), "<br /><strong><b><u>")) . "</p></li>\n    </ul>\n  </div></div>";
  599.         $json_return["search_id"][] = $value->id;
  600.     }
  601.     echo json_encode($json_return, true);
  602.     wp_die();
  603. }
  604. function delete_live_chat()
  605. {
  606.     if (is_admin()) {
  607.         global $wpdb;
  608.         $id = $_POST["id"];
  609.         $wpdb->delete("bt_live_chat", ["id" => $id]);
  610.         echo "Ok";
  611.         wp_die();
  612.     }
  613. }
  614. function read_live_chat()
  615. {
  616.     if (is_admin()) {
  617.         global $wpdb;
  618.         $id = $_POST["id"];
  619.         $wpdb->update("bt_live_chat", ["status" => "0"], ["id" => $id], ["%s"], ["%d"]);
  620.         echo "Ok";
  621.         wp_die();
  622.     }
  623. }
  624. function timeConvert($zaman)
  625. {
  626.     $zaman = strtotime($zaman);
  627.     $zaman_farki = time() - $zaman;
  628.     $saniye = $zaman_farki;
  629.     $dakika = round($zaman_farki / 60);
  630.     $saat = round($zaman_farki / 3600);
  631.     $gun = round($zaman_farki / 86400);
  632.     $hafta = round($zaman_farki / 604800);
  633.     $ay = round($zaman_farki / 2419200);
  634.     $yil = round($zaman_farki / 29030400);
  635.     if ($saniye < 60) {
  636.         if ($saniye == 0) {
  637.             return "az önce";
  638.         }
  639.         return $saniye . " saniye önce";
  640.     }
  641.     if ($dakika < 60) {
  642.         return $dakika . " dakika önce";
  643.     }
  644.     if ($saat < 24) {
  645.         return $saat . " saat önce";
  646.     }
  647.     if ($gun < 7) {
  648.         return $gun . " gün önce";
  649.     }
  650.     if ($hafta < 4) {
  651.         return $hafta . " hafta önce";
  652.     }
  653.     if ($ay < 12) {
  654.         return $ay . " ay önce";
  655.     }
  656.     return $yil . " yıl önce";
  657. }
  658. function percentageCalculator($a, $b)
  659. {
  660.     $returnData = ceil(100 * $a / $b);
  661.     if (is_nan($returnData)) {
  662.         return 0;
  663.     }
  664.     return $returnData;
  665. }
  666. function shortContent($kelime, $str = 10)
  667. {
  668.     if ($str < strlen($kelime)) {
  669.         if (function_exists("mb_substr")) {
  670.             $kelime = mb_substr($kelime, 0, $str, "UTF-8") . "...";
  671.         } else {
  672.             $kelime = substr($kelime, 0, $str) . "...";
  673.         }
  674.     }
  675.     return $kelime;
  676. }
  677. function my_user_profile_edit_action($user)
  678. {
  679.     $checked = isset($user->vip_uye) && $user->vip_uye ? " checked=\"checked\"" : "";
  680.     if (current_user_can("administrator")) {
  681.         echo "  <h3>VIP Üye</h3>\n  <label for=\"vip_uye\">\n    <input name=\"vip_uye\" type=\"checkbox\" id=\"vip_uye\" value=\"1\"";
  682.         echo $checked;
  683.         echo ">\n    Vip üye olmasını istiyorsanız işaretleyin.\n  </label>\n";
  684.     }
  685. }
  686. function my_user_profile_update_action($user_id)
  687. {
  688.     if (current_user_can("administrator")) {
  689.         update_user_meta($user_id, "vip_uye", isset($_POST["vip_uye"]));
  690.     }
  691. }
  692. function checkAccessed()
  693. {
  694.     if (!isset($_COOKIE["accessed"])) {
  695.         setcookie("accessed", "yes", time() + 604800);
  696.         define("ACCESSED", false);
  697.     } else {
  698.         define("ACCESSED", true);
  699.     }
  700. }
  701. function wp_resim_ekle($t, $url, $pid, $bas = NULL, $ozelalan = NULL)
  702. {
  703.     $filename = $bas . (int) $t;
  704.     $filename = remove_accents($filename);
  705.     if (function_exists("mb_strtolower")) {
  706.         $filename = mb_strtolower($filename, "UTF-8");
  707.     }
  708.     $filename = utf8_uri_encode($filename);
  709.     $filetype = wp_check_filetype($url);
  710.     extract($filetype);
  711.     if (!$type) {
  712.         $type = "";
  713.     }
  714.     $upload = wp_upload_bits($filename, $filetype, @file_get_contents($url));
  715.     if (!empty($upload["error"])) {
  716.         return "Resim eklenemedi!<br />Hata: " . $upload["error"] . "<br />";
  717.     }
  718.     $neyim = $upload["file"];
  719.     $attachment = ["guid" => $upload["url"], "post_mime_type" => $type, "post_title" => $bas, "post_content" => "", "post_type" => "attachment", "post_parent" => $pid];
  720.     $attach_id = wp_insert_attachment($attachment, $neyim, $pid);
  721.     $attach_data = wp_generate_attachment_metadata($attach_id, $neyim);
  722.     wp_update_attachment_metadata($attach_id, $attach_data);
  723.     add_post_meta($pid, "_thumbnail_id", $attach_id, true);
  724.     update_post_meta($pid, "_wp_attachment_image_alt", $attach_id, true);
  725.     $nane = $neyim;
  726.     return $nane;
  727. }
  728. function upload_img($t, $url, $pid, $bas = NULL, $ozelalan = NULL)
  729. {
  730.     $filename = $bas . (int) $t;
  731.     $filename = remove_accents($filename);
  732.     if (function_exists("mb_strtolower")) {
  733.         $filename = mb_strtolower($filename, "UTF-8");
  734.     }
  735.     $filename = utf8_uri_encode($filename);
  736.     $filetype = wp_check_filetype($url);
  737.     extract($filetype);
  738.     if (!$type) {
  739.         $type = "";
  740.     }
  741.     $upload = wp_upload_bits($filename, $filetype, @file_get_contents($url));
  742.     if (!empty($upload["error"])) {
  743.         return "Resim eklenemedi!<br />Hata: " . $upload["error"] . "<br />";
  744.     }
  745.     $neyim = $upload["file"];
  746.     $attachment = ["guid" => $upload["url"], "post_mime_type" => $type, "post_title" => $bas, "post_content" => "", "post_type" => "attachment", "post_parent" => $pid];
  747.     $attach_id = wp_insert_attachment($attachment, $neyim, $pid);
  748.     $attach_data = wp_generate_attachment_metadata($attach_id, $neyim);
  749.     wp_update_attachment_metadata($attach_id, $attach_data);
  750.     $nane = $neyim;
  751.     return $upload["url"];
  752. }
  753. function isa_add_every_three_minutes($schedules)
  754. {
  755.     $schedules["every_three_minutes"] = ["interval" => 900, "display" => __("Every 15 Minutes", "textdomain")];
  756.     return $schedules;
  757. }
  758. function data_cron()
  759. {
  760.     include get_template_directory() . "/api/api_helper.php";
  761.     $bahisKaynak = get_url_curl("https://www.bahisanaliz8.com/iddaa-en-cok-oynanan-maclar/");
  762.     preg_match_all("@<div class=\"fl Karsilasma\" style=\"width: 350px;\">(.*?)</div>@si", $bahisKaynak, $matchName);
  763.     preg_match_all("@<div class=\"fl IddaaKodu Tahmin tc\" style=\"width: 60px;\">(.*?)</div>@si", $bahisKaynak, $tahmin);
  764.     preg_match_all("@<div class=\"fl Oran tc\" style=\"width: 55px;\">(.*?)</div>@si", $bahisKaynak, $odd);
  765.     preg_match_all("@<div class=\"fl tr Yuzde\" style=\"width: 55px;\">(.*?)</div>@si", $bahisKaynak, $yuzde);
  766.     $data_json["matchName"] = $matchName;
  767.     $data_json["tahmin"] = $tahmin;
  768.     $data_json["odd"] = $odd;
  769.     $data_json["yuzde"] = $yuzde;
  770.     $bahisKaynak2 = get_url_curl("https://www.bahisanaliz8.com/avrupa-en-cok-oynanan-maclar/");
  771.     preg_match_all("@<div class=\"fl Karsilasma\" style=\"width: 185px;\">(.*?)</div>@si", $bahisKaynak2, $matchName2);
  772.     preg_match_all("@<div class=\"ThmTxt\" style=\"display:none;\">Tahmin: </div><div class=\"ThmDgr fl\">&nbsp;(.*?)</div></div>@si", $bahisKaynak2, $tahmin2);
  773.     preg_match_all("@<div class=\"OranDgr fl\">&nbsp;(.*?)</div>@si", $bahisKaynak2, $odd2);
  774.     preg_match_all("@<div class=\"fl tr Yuzde\" style=\"width: 55px;\">(.*?)</div>@si", $bahisKaynak2, $yuzde2);
  775.     $data_json["matchName2"] = $matchName2;
  776.     $data_json["tahmin2"] = $tahmin2;
  777.     $data_json["odd2"] = $odd2;
  778.     $data_json["yuzde2"] = $yuzde2;
  779.     include get_template_directory() . "/api/puan_durumu.php";
  780.     $data_json["team_tr"] = $team_tr;
  781.     $bahisKaynak3 = get_url_curl("https://www.bahisanaliz8.com/orani-dusen-maclar/");
  782.     preg_match_all("@<div class=\"fl LigAdi pt7\">(.*?)</div>@si", $bahisKaynak3, $ligAdi);
  783.     preg_match_all("@<div class=\"fl GunTarih  pt7\">(.*?)</div>@si", $bahisKaynak3, $gunTarih);
  784.     preg_match_all("@<div class=\"fl Takim tr  pt7\" style=\"width: 111px; overflow:hidden\">(.*?)</div>@si", $bahisKaynak3, $ev_sahibi);
  785.     preg_match_all("@<div class=\"fl Takim pt7 tl\" style=\"width: 104px;\">(.*?)</div>@si", $bahisKaynak3, $deplasman);
  786.     preg_match_all("@<div class=\"ODOranlarIc dnn\">(.*?)<div class=\"fl Takim pt7 tl\"@si", $bahisKaynak3, $oranlar);
  787.     $data_json["ligAdi"] = $ligAdi;
  788.     $data_json["gunTarih"] = $gunTarih;
  789.     $data_json["ev_sahibi"] = $ev_sahibi;
  790.     $data_json["deplasman"] = $deplasman;
  791.     $data_json["oranlar"] = $oranlar;
  792.     $dt = fopen("cron.json", "w");
  793.     fwrite($dt, json_encode($data_json, true));
  794.     fclose($dt);
  795. }
  796.  
  797. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement