Advertisement
Guest User

Untitled

a guest
May 13th, 2025
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.95 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP8 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 8.2.0.1
  8. * @ Author : DeZender
  9. * @ Release on : 27.10.2023
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class SafirPanel
  15. {
  16. public function __construct()
  17. {
  18. $this->dbField = 'safir_' . SAFIR_THEME_SLUG . '_options';
  19. $this->handleSubmits();
  20. }
  21.  
  22. public function showPanel()
  23. {
  24. add_action('admin_menu', [$this, 'adminSidebarMenus']);
  25. add_action('admin_enqueue_scripts', [$this, 'addScripts']);
  26. }
  27.  
  28. public function handleSubmits()
  29. {
  30. if (is_admin() && current_user_can('administrator')) {
  31. if (isset($_GET['page']) && $_GET['page'] == 'safirpanel') {
  32. if (isset($_REQUEST['saveButton'])) {
  33. $this->saveOptions();
  34. return NULL;
  35. }
  36.  
  37. if (isset($_REQUEST['resetButton'])) {
  38. $this->resetOptions();
  39. return NULL;
  40. }
  41.  
  42. if (isset($_REQUEST['resetSectionButton'])) {
  43. $this->resetOptions($_REQUEST['activeSection']);
  44. return NULL;
  45. }
  46.  
  47. if (isset($_REQUEST['importButton'])) {
  48. $this->importOptions();
  49. return NULL;
  50. }
  51.  
  52. if (isset($_REQUEST['hiddenSaveButton'])) {
  53. $this->saveOptions();
  54. }
  55. }
  56. }
  57. }
  58.  
  59. public function addScripts($hook_suffix)
  60. {
  61. if ($hook_suffix == 'toplevel_page_safirpanel') {
  62. wp_enqueue_script('media-upload');
  63. wp_enqueue_script('safirpanel', get_template_directory_uri() . '/safirpanel/scripts/scripts.js', ['jquery'], filemtime(get_template_directory() . '/safirpanel/scripts/scripts.js'), true);
  64. $editor_settings['codeEditor'] = wp_enqueue_code_editor(['type' => 'text/html']);
  65. wp_localize_script('jquery', 'editor_settings', $editor_settings);
  66. wp_enqueue_style('safirpanel', get_template_directory_uri() . '/safirpanel/css/style.css', [], filemtime(get_template_directory() . '/safirpanel/css/style.css'));
  67. }
  68. }
  69.  
  70. public function adminSidebarMenus()
  71. {
  72. add_menu_page('Safir Panel', 'Safir Panel', 'edit_posts', 'safirpanel', [$this, 'safirpanelPage']);
  73. add_submenu_page('safirpanel', 'Tema Ayarları', 'Tema Ayarları', 'administrator', 'safirpanel', [$this, 'safirpanelPage']);
  74. global $safirAdminSidebarMenus;
  75.  
  76. foreach ($safirAdminSidebarMenus as $slug => $data) {
  77. add_submenu_page('safirpanel', $data['name'], $data['name'], 'edit_posts', $slug, $data['func']);
  78. }
  79. }
  80.  
  81. public function getOptions()
  82. {
  83. return json_decode(get_option($this->dbField));
  84. }
  85.  
  86. public function safirpanelPage()
  87. {
  88. if (get_option('safirpanel_need_update')) {
  89. safirMakeRequest('activation');
  90. update_option('safirpanel_need_update', 0);
  91. }
  92.  
  93. include get_template_directory() . '/lib/safirtema/safiroptions.php';
  94. echo "\t\t" . '<div class="wrap" id="safirpanel" data-sections="';
  95. echo implode(',', array_keys($safirOptions));
  96. echo ',importexport">' . "\n\t\t\t";
  97.  
  98. if (isset($this->outputMessage)) {
  99. echo "\t\t\t\t" . '<div class="updated">' . "\n\t\t\t\t\t" . '<p>';
  100. echo $this->outputMessage;
  101. echo '</p>' . "\n\t\t\t\t" . '</div>' . "\n\t\t\t\t";
  102.  
  103. if (function_exists('safir_delete_cache')) {
  104. safir_delete_cache();
  105. }
  106. }
  107.  
  108. echo "\t\n\t\t\t" . '<div id="top">' . "\n\t\t\t\t" . '<div class="logo">' . "\n\t\t\t\t\t" . '<img src="';
  109. echo esc_url(get_template_directory_uri());
  110. echo '/safirpanel/images/logo.png" width="180" height="70" />' . "\n\t\t\t\t" . '</div>' . "\n\t\t\t\t" . '<div id="heading">' . "\n\t\t\t\t\t" . '<div class="arrow"></div>' . "\n\t\t\t\t\t" . '<div class="titles">' . "\n\t\t\t\t\t\t";
  111.  
  112. foreach ($safirOptions as $key => $value) {
  113. echo "\t\t\t\t\t\t\t" . '<div class="title" id="safirpanel_title_';
  114. echo $key;
  115. echo '">';
  116. echo $value['title'];
  117. echo '</div>' . "\n\t\t\t\t\t\t\t";
  118. }
  119.  
  120. echo "\t\t\t\t\t\t" . '<div class="title" id="safirpanel_title_importexport">' . "\n\t\t\t\t\t\t\t" . 'İçe / Dışa Aktar' . "\t\n\t\t\t\t\t\t" . '</div>' . "\n\t\t\t\t\t" . '</div>' . "\n\t\t\t\t\t" . '<a class="help" target="_blank" title="Tema Yardım Dosyası" href="https://safirtema.com/yardim/';
  121. echo SAFIR_THEME_SLUG;
  122. echo '/">YARDIM</a>' . "\n\t\t\t\t" . '</div>' . "\n\t\t\t" . '</div>' . "\n\t\t\t" . '<div id="safirpanelmain">' . "\n\t\t\t\t" . '<div id="safirpanelleft">' . "\n\t\t\t\t\t" . '<ul class="safirmenu">' . "\n\t\t\t\t\t\t";
  123.  
  124. foreach ($safirOptions as $key => $value) {
  125. echo "\t\t\t\t\t\t\t" . '<li id="safirpanel_menuitem_';
  126. echo $key;
  127. echo '">' . "\n\t\t\t\t\t\t\t\t" . '<a href="#';
  128. echo $key;
  129. echo '" data-hash="';
  130. echo $key;
  131. echo '" class="';
  132. echo $key;
  133. echo '">' . "\n\t\t\t\t\t\t\t\t\t" . '<span class="icon"></span>' . "\n\t\t\t\t\t\t\t\t\t";
  134. echo $value['title'];
  135. echo "\t\t\t\t\t\t\t\t" . '</a>' . "\n\t\t\t\t\t\t\t" . '</li>' . "\n\t\t\t\t\t\t\t";
  136. }
  137.  
  138. echo "\t\t\t\t\t\t" . '<li id="safirpanel_menuitem_importexport">' . "\n\t\t\t\t\t\t\t" . '<a href="#importexport" data-hash="importexport" class="importexport">' . "\n\t\t\t\t\t\t\t\t" . '<span class="icon"></span>' . "\n\t\t\t\t\t\t\t\t" . 'İçe / Dışa Aktar' . "\n\t\t\t\t\t\t\t" . '</a>' . "\n\t\t\t\t\t\t" . '</li>' . "\n\t\t\t\t\t" . '</ul>' . "\n\t\t\t\t" . '</div>' . "\n\t\n\t\t\t\t" . '<div id="safirpanelright">' . "\n\t\t\t\t\t" . '<div id="sections">' . "\n\t\t\t\t\t\t" . '<form method="post" action="">' . "\n\t\t\t\t\t\t\t" . '<div style="display: none">' . "\n\t\t\t\t\t\t\t\t" . '<input type="submit">' . "\n\t\t\t\t\t\t\t" . '</div>' . "\n\t\t\t\t\t\t\t";
  139.  
  140. foreach ($safirOptions as $key => $value) {
  141. echo "\t\t\t\t\t\t\t\t" . '<div class="section" id="safirpanel_section_';
  142. echo $key;
  143. echo '">' . "\n\t\t\t\t\t\t\t\t\t";
  144. $datas = $value['data'];
  145.  
  146. if (is_array($datas)) {
  147. foreach ($datas as $key => $value) {
  148. include get_template_directory() . '/safirpanel/parts/' . $value['type'] . '.php';
  149. }
  150. }
  151.  
  152. echo "\t\t\t\t\t\t\t\t" . '</div>' . "\n\t\t\t\t\t\t\t\t";
  153. }
  154.  
  155. echo "\t\t\t\t\t\t\t" . '<div class="section" id="safirpanel_section_importexport">' . "\n\t\t\t\t\t\t\t\t" . '<div class="safirpanelItem aligntop codeeditor">' . "\n\t\t\t\t\t\t\t\t\t" . '<div class="desc">' . "\n\t\t\t\t\t\t\t\t\t\t" . '<div class="title">İçe Aktar</div>' . "\n\t\t\t\t\t\t\t\t\t" . '</div>' . "\n\t\t\t\t\t\t\t\t\t" . '<div class="infoBox">Daha önce dışa aktardığınız Safirpanel ayarlarına ait metin belgesini yükleyin veya dosya içindeki kodları kopyalayıp buraya yapıştırın. Ardından İçe Aktar butonu ile ayarları yükleyebilirsiniz.</div>' . "\n\t\t\t\t\t\t\t\t\t" . '<div class="formitem">' . "\n\t\t\t\t\t\t\t\t\t\t" . '<textarea name="safir_import" id="safir_import"></textarea>' . "\n\t\t\t\t\t\t\t\t\t" . '</div>' . "\n\t\t\t\t\t\t\t\t\t" . '<input id="hiddenUploadImportFileButton" type="file" style="display: none" />' . "\n\t\t\t\t\t\t\t\t\t" . '<input type="button" id="uploadImportFileButton" class="button button-primary" value="Dosya Yükle" style="margin-right: 5px" />' . "\n\t\t\t\t\t\t\t\t\t" . '<input type="submit" id="importButton" name="importButton" class="button" value="İçe Aktar" />' . "\n\t\t\t\t\t\t\t\t" . '</div>' . "\n\n\t\t\t\t\t\t\t\t" . '<div class="seperator"></div>' . "\n\n\t\t\t\t\t\t\t\t" . '<div class="safirpanelItem aligntop codeeditor">' . "\n\t\t\t\t\t\t\t\t\t" . '<div class="desc">' . "\n\t\t\t\t\t\t\t\t\t\t" . '<div class="title">Dışa Aktar</div>' . "\n\t\t\t\t\t\t\t\t\t" . '</div>' . "\n\t\t\t\t\t\t\t\t\t" . '<div class="infoBox">Safirpanel ayarlarını Dışa Aktar butonu ile bir metin belgesi olarak dışa aktarabilirsiniz. Daha sonra bu dosya içindeki kodları İçe Aktar bölümü ile tekrar yükleyebilirsiniz. Dışa aktarma son kaydedilen ayarları dışa aktarır.</div>' . "\n\t\t\t\t\t\t\t\t\t" . '<div class="formitem">' . "\n\t\t\t\t\t\t\t\t\t\t" . '<textarea disabled id="safir_export" name="safir_export">';
  156. $options = $this->getOptions();
  157. echo json_encode($options, JSON_UNESCAPED_SLASHES);
  158. ................................................................
  159. .............................
  160. ...............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement