Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.1
- * @ Author : DeZender
- * @ Release on : 29.08.2020
- * @ Official site : http://DeZender.Net
- *
- */
- class Menu_Icon_Plugin
- {
- public function __construct()
- {
- add_action('save_post_nav_menu_item', [$this, 'menu_image_save_post_action'], 10, 3);
- add_filter('wp_setup_nav_menu_item', [$this, 'menu_image_wp_setup_nav_menu_item']);
- add_filter('nav_menu_css_class', [$this, 'nav_menu_css_class_filter'], 10, 5);
- add_action('admin_init', [$this, 'admin_init'], 99);
- }
- public function admin_init()
- {
- if (!has_action('wp_nav_menu_item_custom_fields')) {
- add_filter('wp_edit_nav_menu_walker', [$this, 'menu_image_edit_nav_menu_walker_filter']);
- }
- add_action('wp_nav_menu_item_custom_fields', [$this, 'menu_item_custom_fields'], 10, 4);
- }
- public function menu_image_save_post_action($post_id, $post)
- {
- $menu_image_settings = ['menu_item_sfr_menu_icon'];
- foreach ($menu_image_settings as $setting_name) {
- if ($post->{'_' . $setting_name} != $_POST[$setting_name][$post_id]) {
- update_post_meta($post_id, '_' . $setting_name, esc_sql($_POST[$setting_name][$post_id]));
- }
- }
- }
- public function menu_image_edit_nav_menu_walker_filter()
- {
- return 'Menu_Image_Walker_Nav_Menu_Edit';
- }
- public function menu_image_wp_setup_nav_menu_item($item)
- {
- if (!isset($item->sfr_menu_icon)) {
- $item->sfr_menu_icon = get_post_meta($item->ID, '_menu_item_sfr_menu_icon', true);
- }
- return $item;
- }
- public function nav_menu_css_class_filter($classes, $item)
- {
- $classes[] = $item->sfr_menu_icon;
- return $classes;
- }
- public function wp_post_thumbnail_html($item_id)
- {
- global $safirIcons;
- $content = '';
- $sfr_menu_icon = get_post_meta($item_id, '_menu_item_sfr_menu_icon', true);
- ob_start();
- echo "\n\t\t" . '<div class="menu-item-image-options">' . "\n\t\t\t" . '<div class="description description-wide">' . "\n\t\t\t\t" . '<label for="edit-menu-item-image-size-';
- echo $item_id;
- echo '">Menü ikonu' . "\n\t\t\t\t" . '</label>' . "\n\t\t\t\t\t" . '<br />' . "\n\t\t\t\t\t" . '<input type="text" id="edit-menu-item-image-size-';
- echo $item_id;
- echo '"' . "\n\t\t\t\t\t\t" . 'class="widefat iconTextBox"' . "\n\t\t\t\t\t\t" . 'name="menu_item_sfr_menu_icon[';
- echo $item_id;
- echo ']" value="';
- echo $sfr_menu_icon;
- echo '" style="z-index:1" autocomplete="off">' . "\n\n\n\t\t\t\t\t" . '<div class="safirAdminIconSelector" style="display:none; z-index:2">' . "\n\t\t\t\t\t\t" . '<div class="close">X</div>' . "\n\t\t\t\t\t\t";
- foreach ($safirIcons as $key => $code) {
- echo "\t\t\t\t\t\t\t" . '<div class="item ';
- echo $key;
- echo ' ';
- if ($key == $sfr_menu_icon) {
- echo 'active';
- }
- echo '" data-value="';
- echo $key;
- echo '" >' . "\n\t\t\t\t\t\t\t\t" . '<div class="inner">' . "\n\t\t\t\t\t\t\t\t\t" . '<span class="icon"></span>' . "\n\t\t\t\t\t\t\t\t" . '</div>' . "\n\t\t\t\t\t\t\t" . '</div>' . "\n\t\t\t\t\t\t";
- }
- echo "\t\t\t\t\t" . '</div>' . "\n\n\t\t\t\t\t" . '<style>' . "\n\t\t\t\t\t";
- foreach ($safirIcons as $key => $code) {
- echo "\t\t\t\t\t" . '.safirAdminIconSelector .item.';
- echo $key;
- echo ' span.icon:before {' . "\n\t\t\t\t\t\t" . 'content:"';
- echo $code;
- echo '";' . "\n\t\t\t\t\t" . '}' . "\n\t\t\t\t\t";
- }
- echo "\t\t\t\t\t" . '</style>' . "\n\n\t\t\t" . '</div>' . "\n\t\t" . '</div>' . "\n\n\t\t";
- $content .= ob_get_clean();
- return apply_filters('admin_menu_item_thumbnail_html', $content, $item_id);
- }
- public function menu_item_custom_fields($item_id, $item, $depth, $args)
- {
- if (!$item_id && isset($item->ID)) {
- $item_id = $item->ID;
- }
- echo "\t\t" . '<div class="field-image hide-if-no-js wp-media-buttons">' . "\n\t\t\t";
- echo $this->wp_post_thumbnail_html($item_id);
- echo "\t\t" . '</div>' . "\n\t";
- }
- public function setUsedAttachments($size, $id)
- {
- $this->used_attachments[$size][] = $id;
- }
- public function isAttachmentUsed($id, $size = NULL)
- {
- if (!is_null($size)) {
- return is_string($size) && isset($this->used_attachments[$size]) && in_array($id, $this->used_attachments[$size]);
- }
- else {
- foreach ($this->used_attachments as $used_attachment) {
- if (in_array($id, $used_attachment)) {
- return true;
- }
- }
- return false;
- }
- }
- }
- function get_domain($url)
- {
- $pieces = parse_url($url);
- $domain = (isset($pieces['host']) ? $pieces['host'] : '');
- if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\\-]{1,63}\\.[a-z\\.]{2,6})$/i', $domain, $regs)) {
- return $regs['domain'];
- }
- return false;
- }
- function __gc()
- {
- $site = get_domain(get_bloginfo('url'));
- $key = 'R->O->T->A->W->P';
- $sfrLicenseCode = hash('sha1', $site . $key);
- $sfrLicenseCode = implode('-', str_split($sfrLicenseCode, 4));
- return $sfrLicenseCode;
- }
- function add_nofollow_cat($text)
- {
- $text = str_replace('rel="category tag"', '', $text);
- return $text;
- }
- function adminBarMenu()
- {
- global $wp_admin_bar;
- if (!is_super_admin() || !is_admin_bar_showing()) {
- return NULL;
- }
- $wp_admin_bar->add_menu(['id' => 'safir_link', 'title' => 'Safir Panel - Tema Ayarları', 'href' => get_bloginfo('url') . '/wp-admin/admin.php?page=safirpanel.php']);
- }
- function xoption($option)
- {
- $returnedValue = get_option('safir_rota_' . $option);
- if (is_string($returnedValue)) {
- return stripslashes($returnedValue);
- }
- else {
- return $returnedValue;
- }
- }
- function setxoption($option, $newvalue)
- {
- update_option('safir_rota_' . $option, $newvalue);
- }
- function safir_init_widgets()
- {
- register_widget('sfrNumberWidget');
- register_widget('sfrCategoriesWidget');
- register_widget('sfrAdvancedPages');
- register_widget('sfrAdvancedPostsWidget1');
- ....................................................................................
- .....................................................
- .........................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement