FM

/home/u523506497/domains/mymelon.in/public_html/wp-content/plugins/ai-engine/classes UP

<?php

class Meow_MWAI_Admin extends MeowKit_MWAI_Admin {
  public $core;
  public $contentGeneratorEnabled;
  public $imagesGeneratorEnabled;
  public $videosGeneratorEnabled;
  public $playgroundEnabled;
  public $suggestionsEnabled;

  public function __construct( $core ) {
    $this->core = $core;
    parent::__construct( MWAI_PREFIX, MWAI_ENTRY, MWAI_DOMAIN, class_exists( 'MeowPro_MWAI_Core' ) );
    if ( is_admin() ) {
      $this->contentGeneratorEnabled = $this->core->get_option( 'module_generator_content' );
      $this->imagesGeneratorEnabled = $this->core->get_option( 'module_generator_images' );
      $this->videosGeneratorEnabled = $this->core->get_option( 'module_generator_videos' );
      $this->playgroundEnabled = $this->core->get_option( 'module_playground' );
      $can_access_settings = $this->core->can_access_settings();
      $can_access_features = $this->core->can_access_features();

      if ( $can_access_settings || $can_access_features ) {
        add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
      }

      if ( $can_access_settings ) {
        add_action( 'admin_menu', [ $this, 'app_menu' ] );
      }

      if ( $can_access_features ) {
        add_action( 'admin_menu', [ $this, 'admin_menu' ] );

        // Only if the Suggestions are enabled.
        $this->suggestionsEnabled = $this->core->get_option( 'module_suggestions' );
        if ( $this->suggestionsEnabled ) {
          add_filter( 'post_row_actions', [ $this, 'post_row_actions' ], 10, 2 );
          add_filter( 'page_row_actions', [ $this, 'post_row_actions' ], 10, 2 );
        }

        if ( $this->imagesGeneratorEnabled ) {
          add_filter( 'media_row_actions', [ $this, 'media_row_actions' ], 10, 2 );
        }

        add_action( 'admin_footer', [ $this, 'admin_footer' ] );
      }
    }
  }

  public function admin_menu() {

    // Generate New (under Posts)
    if ( $this->contentGeneratorEnabled ) {
      add_submenu_page(
        'edit.php',
        'Generate New',
        'Generate New',
        'read',
        'mwai_content_generator',
        [ $this, 'ai_content_generator' ],
        2
      );
    }

    // In Tools
    if ( $this->playgroundEnabled ) {
      add_management_page(
        'Playground',
        __( 'Playground', 'ai-engine' ),
        'read',
        'mwai_dashboard',
        [ $this, 'ai_playground' ]
      );
    }
    if ( $this->contentGeneratorEnabled ) {
      add_management_page(
        'Generate Content',
        'Generate Content',
        'read',
        'mwai_content_generator',
        [ $this, 'ai_content_generator' ]
      );
    }
    if ( $this->imagesGeneratorEnabled ) {
      add_management_page(
        'Generate Images',
        'Generate Images',
        'read',
        'mwai_images_generator',
        [ $this, 'ai_image_generator' ]
      );
    }
    if ( $this->videosGeneratorEnabled ) {
      add_management_page(
        'Generate Videos',
        'Generate Videos',
        'read',
        'mwai_videos_generator',
        [ $this, 'ai_video_generator' ]
      );
    }

    // In the Admin Bar:
    add_action( 'admin_bar_menu', [ $this, 'admin_bar_menu' ], 100 );
  }

  public function admin_bar_menu( $wp_admin_bar ) {

    $admin_bar = $this->core->get_option( 'admin_bar' );
    $settings = isset( $admin_bar['settings'] ) && $admin_bar['settings'];
    $playground = isset( $admin_bar['playground'] ) && $admin_bar['playground'];
    $content_generator = isset( $admin_bar['content_generator'] ) && $admin_bar['content_generator'];
    $images_generator = isset( $admin_bar['images_generator'] ) && $admin_bar['images_generator'];
    $videos_generator = isset( $admin_bar['videos_generator'] ) && $admin_bar['videos_generator'];

    if ( $settings ) {
      $wp_admin_bar->add_node( [
        'id' => 'mwai-settings',
        'title' => '<span class="ab-icon dashicons-before dashicons-admin-settings" style="top: 2px;"></span>' . __( 'AI Engine', 'ai-engine' ),
        'href' => admin_url( 'admin.php?page=mwai_settings' ),
        'meta' => [ 'class' => 'mwai-settings' ],
      ] );
    }

    if ( $content_generator ) {
      $wp_admin_bar->add_node( [
        'id' => 'mwai-content-generator',
        'title' => MWAI_IMG_WAND_HTML . __( 'Content', 'ai-engine' ),
        'href' => admin_url( 'tools.php?page=mwai_content_generator' ),
        'meta' => [ 'class' => 'mwai-content-generator' ],
      ] );
    }
    if ( $images_generator ) {
      $wp_admin_bar->add_node( [
        'id' => 'mwai-image-generator',
        'title' => MWAI_IMG_WAND_HTML . __( 'Images', 'ai-engine' ),
        'href' => admin_url( 'tools.php?page=mwai_images_generator' ),
        'meta' => [ 'class' => 'mwai-images-generator' ],
      ] );
    }
    if ( $videos_generator ) {
      $wp_admin_bar->add_node( [
        'id' => 'mwai-video-generator',
        'title' => MWAI_IMG_WAND_HTML . __( 'Videos', 'ai-engine' ),
        'href' => admin_url( 'tools.php?page=mwai_videos_generator' ),
        'meta' => [ 'class' => 'mwai-videos-generator' ],
      ] );
    }

    // The Global Magic Wand
    // if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
    //   $wp_admin_bar->add_node( array(
    //     'id' => 'mwai-debug',
    //     'title' => MWAI_IMG_WAND_HTML . __( 'Magic Wand', 'ai-engine' ),
    //     //'href' => admin_url( 'tools.php?page=mwai_debug' ),
    //     'meta' => array( 'class' => 'mwai-debug' ),
    //   ) );
    // }

    if ( $playground ) {
      $wp_admin_bar->add_node( [
        'id' => 'mwai-playground',
        'title' => MWAI_IMG_WAND_HTML . __( 'Playground', 'ai-engine' ),
        'href' => admin_url( 'tools.php?page=mwai_dashboard' ),
        'meta' => [ 'class' => 'mwai-playground' ],
      ] );
    }
  }

  public function ai_playground() {
    echo '<div id="mwai-playground"></div>';
  }

  public function ai_content_generator() {
    echo '<div id="mwai-content-generator"></div>';
  }

  public function ai_image_generator() {
    echo '<div id="mwai-image-generator"></div>';
  }

  public function ai_video_generator() {
    echo '<div id="mwai-video-generator"></div>';
  }

  public function post_row_actions( $actions, $post ) {
    $actions['ai_magic_wand'] = '<span class="mwai-magic-wand-action" data-id="' . $post->ID . '" data-title="' . esc_attr( $post->post_title ) . '">
      <a href="#" class="mwai-magic-wand-trigger">' . MWAI_IMG_WAND_HTML_XS . ' ' . __( 'Magic Wand', 'ai-engine' ) . '</a>
      <div class="mwai-magic-wand-dropdown" style="display: none;">
        <a class="mwai-link-title" href="#" data-id="' . $post->ID . '" data-title="' . esc_attr( $post->post_title ) . '">
          <span class="dashicons dashicons-edit" style="font-size: 14px; line-height: 1.4; margin-right: 4px; pointer-events: none;"></span>' . __( 'Generate Title', 'ai-engine' ) . '
        </a>
        <a class="mwai-link-excerpt" href="#" data-id="' . $post->ID . '" data-title="' . esc_attr( $post->post_title ) . '">
          <span class="dashicons dashicons-text" style="font-size: 14px; line-height: 1.4; margin-right: 4px; pointer-events: none;"></span>' . __( 'Generate Excerpt', 'ai-engine' ) . '
        </a>
      </div>
    </span>';
    return $actions;
  }

  public function media_row_actions( $actions, $post ) {
    if ( strpos( $post->post_mime_type, 'image/' ) === 0 ) {
      $url = admin_url( 'tools.php?page=mwai_images_generator&editId=' . $post->ID );
      $actions['mwai_remix'] = '<a href="' . $url . '">' . MWAI_IMG_WAND_HTML_XS . ' ' . __( 'Edit', 'ai-engine' ) . '</a>';
    }
    return $actions;
  }

  public function admin_footer() {
    // Don't add our admin footer div on the Site Editor
    $current_screen = get_current_screen();
    if ( $current_screen && $current_screen->base === 'site-editor' ) {
      return;
    }
    echo '<div id="mwai-admin-postsList"></div>';

    // Add CSS for Magic Wand dropdown
    ?>
    <style>
      .mwai-magic-wand-action {
        position: relative;
        display: inline-block;
      }
      
      .mwai-magic-wand-trigger {
        text-decoration: none;
      }
      
      .mwai-magic-wand-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        background: #fff;
        border: 1px solid #c3c4c7;
        border-radius: 4px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.15);
        min-width: 150px;
        z-index: 1000;
        margin-top: 4px;
      }
      
      .mwai-magic-wand-dropdown a {
        display: flex;
        align-items: center;
        padding: 8px 12px;
        text-decoration: none;
        color: #2271b1;
        border-bottom: 1px solid #f0f0f1;
        white-space: nowrap;
      }
      
      .mwai-magic-wand-dropdown a .dashicons {
        width: 16px;
        height: 16px;
        font-size: 14px;
      }
      
      .mwai-magic-wand-dropdown a:last-child {
        border-bottom: none;
      }
      
      .mwai-magic-wand-dropdown a:hover {
        background: #f0f6fc;
        color: #135e96;
      }
      
      /* Ensure dropdown stays visible when hovering over it */
      .mwai-magic-wand-action:hover .mwai-magic-wand-dropdown {
        display: block !important;
      }
    </style>
    <?php
  }

  public function admin_enqueue_scripts() {
    // Previously bailed entirely on the Site Editor to avoid conflicts, but that left
    // our block types unregistered there - patterns created via Appearance > Editor saved
    // broken "Unsupported" placeholders for every AI Form/Chatbot block. The conditional
    // dependency logic below already keeps wp-edit-post out of the Site Editor dep list,
    // so the bundle can safely load here for block registration while the admin UI
    // render targets (mwai-admin-settings, etc.) simply don't exist.
    $current_screen = get_current_screen();

    $physical_file = MWAI_PATH . '/app/index.js';
    $cache_buster = file_exists( $physical_file ) ? filemtime( $physical_file ) : MWAI_VERSION;

    // Cache override: Force cache refresh when ?mwai_cache=1 is in URL
    if ( isset( $_GET['mwai_cache'] ) ) {
      $cache_buster = time(); // Use current timestamp for guaranteed cache bust
    }

    wp_register_script( 'mwai-vendor', MWAI_URL . 'app/vendor.js', null, $cache_buster );

    // Base dependencies
    $deps = [ 'mwai-vendor', 'wp-element', 'wp-components', 'wp-plugins', 'wp-i18n' ];

    // Check if we're on AI Engine admin pages
    $is_ai_engine_page = $current_screen && (
      strpos( $current_screen->id, 'mwai_settings' ) !== false ||
      strpos( $current_screen->id, 'meowapps_page_mwai' ) !== false ||
      $current_screen->id === 'meowapps_page_mwai_settings' ||
      $current_screen->id === 'meowapps_page_mwai-ui' ||
      strpos( $current_screen->id, 'meowapps' ) !== false && strpos( $_GET['page'] ?? '', 'mwai' ) !== false
    );

    // Only add wp-edit-post on actual post/page editor screens, not on AI Engine admin pages
    $is_post_editor = $current_screen && in_array( $current_screen->base, [ 'post', 'page' ] );
    if ( $is_post_editor ) {
      $deps[] = 'wp-edit-post';
    }

    // Load block editor deps if:
    // 1. We're on AI Engine admin pages (Forms.js component is always imported by Settings.js) OR
    // 2. We are on a block editor screen (Edit Post)
    $forms_module_enabled = $this->core->get_option( 'module_forms' );
    $load_forms_editor = $forms_module_enabled && $this->core->get_option( 'forms_editor' );
    $on_block_editor = function_exists( 'wp_should_load_block_editor_scripts_and_styles' ) && wp_should_load_block_editor_scripts_and_styles();

    // Always load block editor deps on AI Engine admin pages because Forms.js is always imported
    if ( $is_ai_engine_page || $on_block_editor ) {
      $deps = array_merge( $deps, [ 'wp-blocks', 'wp-block-editor', 'wp-format-library', 'wp-block-library', 'wp-editor' ] );
    }

    wp_register_script( 'mwai', MWAI_URL . 'app/index.js', $deps, $cache_buster );
    wp_enqueue_script( 'mwai' );

    // Ensure core editor styles are available for embedded block editor UIs
    // This helps Popovers, Inspector, and toolbars match Gutenberg styling
    if ( function_exists( 'wp_enqueue_style' ) ) {
      // Only load wp-edit-post styles on actual post/page editor screens
      if ( $is_post_editor ) {
        @wp_enqueue_style( 'wp-edit-post' );
      }
      @wp_enqueue_style( 'wp-components' );

      // Load block editor styles if we're on AI Engine pages or on block editor
      if ( $is_ai_engine_page || $on_block_editor ) {
        @wp_enqueue_style( 'wp-block-editor' );
        @wp_enqueue_style( 'wp-block-library' );
      }
    }
    // Make sure core blocks and format tools are registered/available
    if ( function_exists( 'wp_enqueue_script' ) ) {
      if ( $is_ai_engine_page || $on_block_editor ) {
        @wp_enqueue_script( 'wp-format-library' );
        @wp_enqueue_script( 'wp-block-library' );
        @wp_enqueue_script( 'wp-editor' );
      }
    }

    // The MD5 of the translation file built by WP uses app/i18n.js instead of app/index.js
    add_filter( 'load_script_translation_file', function ( $file, $handle, $domain ) {
      if ( $domain !== 'ai-engine' ) {
        return $file;
      }
      $file = str_replace( md5( 'app/index.js' ), md5( 'app/i18n.js' ), $file );
      return $file;
    }, 10, 3 );

    // This is useless for AI Engine, but it avoids issues when themes and plugin calls
    // wp_enqueue_media too late (usually, they call it in the footer). Until someone
    // figures out what the issue is, let's load it here.
    wp_enqueue_media();

    wp_set_script_translations( 'mwai', 'ai-engine' );

    // Prepare localization data
    // Get build reference for asset management
    $build_ref = null;
    if ( class_exists( 'MeowKitPro_MWAI_Integrity' ) ) {
      $integrity = new MeowKitPro_MWAI_Integrity( MWAI_PREFIX, MWAI_PATH );
      $build_ref = $integrity->get_build_ref( MWAI_VERSION );
    }

    $localize_data = [
      'api_url' => get_rest_url( null, 'mwai/v1' ),
      'rest_url' => get_rest_url(),
      'plugin_url' => MWAI_URL,
      'user_data' => $this->core->get_user_data(),
      'prefix' => MWAI_PREFIX,
      'domain' => MWAI_DOMAIN,
      'is_pro' => class_exists( 'MeowPro_MWAI_Core' ),
      'is_registered' => !!$this->is_registered(),
      'build_ref' => $build_ref,
      'rest_nonce' => wp_create_nonce( 'wp_rest' ),
      'session' => $this->core->get_session_id(),
      'options' => $this->core->get_all_options(),
      'chatbots' => $this->core->get_chatbots(),
      'themes' => $this->core->get_themes(),
      'stream' => $this->core->get_option( 'ai_streaming' ),
      'cache_buster' => $cache_buster, // Pass cache buster for lazy-loaded chunks
      'fallback_models' => [
        'default' => MWAI_FALLBACK_MODEL,
        'fast' => MWAI_FALLBACK_MODEL_FAST,
        'vision' => MWAI_FALLBACK_MODEL_VISION,
        'json' => MWAI_FALLBACK_MODEL_JSON,
        'images' => MWAI_FALLBACK_MODEL_IMAGES,
        'audio' => MWAI_FALLBACK_MODEL_AUDIO,
        'embeddings' => MWAI_FALLBACK_MODEL_EMBEDDINGS,
      ],
      'integrations' => [
        'polylang' => function_exists( 'pll_get_post_language' ),
        'woocommerce' => class_exists( 'WooCommerce' ),
      ],
    ];

    wp_localize_script( 'mwai', 'mwai', $localize_data );
  }

  public function is_registered() {
    return apply_filters( MWAI_PREFIX . '_meowapps_is_registered', false, MWAI_PREFIX );
  }

  public function app_menu() {
    // The menu is only registered when can_access_settings() passed (see __construct).
    // Pass a low cap here so WordPress doesn't hide the submenu from filter-approved
    // users who don't have manage_options. The page callback re-checks access for
    // defense in depth.
    add_submenu_page(
      'meowapps-main-menu',
      'AI Engine',
      'AI Engine',
      'read',
      'mwai_settings',
      [ $this, 'admin_settings' ]
    );
  }

  public function admin_settings() {
    if ( !$this->core->can_access_settings() ) {
      wp_die( __( 'Sorry, you are not allowed to access this page.', 'ai-engine' ), 403 );
    }
    echo '<div id="mwai-admin-settings"></div>';
  }
}
admin.php16222V
api.php46860V
core.php64466V
data-
discussion.php1170V
engines-
event.php6707V
exceptions-
init.php5132V
logging.php8152V
modules-
query-
reply.php12892V
rest-
rest.php115213V
services-
MyMelon - Digital Marketing and Creative Agency in Delhi, India
Skip to content Skip to footer

MyMelon Home Page

Bored Of Old School Strategies?

Conventional strategies do no justice to complex modern problems. Bringing in kickass blueprints to escalate your exclusive ideas to the growth trajectory.

MyMelon Home Page (1)

Falling In Love With Your Problems

Your problems are our play! You get to decide which ‘solutions’ feel like an astounding fuck yes!

Discover pitch-perfect marketing strategies to deliver complex ideas into simplified solutions. 

Diversity in our problem solving approach makes us who we are!

You Do You

For us every client and their offerings are unique. We offer tailored and hot-off-the-press strategies to produce a unique brand identity. Listening, evolving, and promoting your articles of faith is what makes our work kickass and compelling too!

#
Award
Type
Project
01
Best Project
Art Business
Business Style
2017
02
Best Design
Creative Work
Best Designers
2018
03
Best Concept
New Strategy
Branding Concept
2019
04
Best Picture
Visualization
Small Figures
2020

Our Inspirations

Vivekanand

Arise, awake, and stop not until the goal is achieved

Dr APJ Abdul Kalam

Creativity is seeing the same thing but thinking differently

Christopher Columbus

By prevailing over all obstacles one may unfailingly arrive at his chosen goal.

JRD Tata

Uncommon thinkers reuse what common thinkers refuse.

Lead The Way With Your New Digital Partners

Waiting to get viral? Don’t worry we’ve got your back!

Leading your way through business acumen and business strategies tailored to your needs.

Handholding you since your first lightbulb moment to making a mark in the industry through unique formulas.  Bringing unexpected things to the table is in our DNA.

Producing Tailored Solutions

One solution for multiple solutions is hard to swallow. Creating tailored solutions for your unique problems

Setting Benchmarks

Doesn’t carving a path for others give the best kick ever?

Making A Difference

You can’t wait for a case study. You will be too late!

Blogs

Contact Us

We work hard and then succeed on purpose.

We are constantly looking for a needle in a haystack and connecting to get the deal to happen!

If you've loved our idea and want to take the road less traveled, reach out to us on …….

Before you take the sure-shots of success, let's take some shots of vodka!

    Polscy gracze coraz częściej wybierają kasyno bez weryfikacji przy wypłacie bez ukrytych opłat, aby cieszyć się szybkim dostępem do gier i przejrzystymi warunkami wypłaty wygranych. Tego typu platformy stawiają na uproszczoną rejestrację, nowoczesne metody płatności oraz jasne zasady dotyczące transakcji. Przed rozpoczęciem gry warto zapoznać się z opiniami innych użytkowników, aby ocenić jakość obsługi i niezawodność serwisu.

    Jeśli chcesz znaleźć rzetelne opinie oraz porównać najlepsze platformy, casino Revolut Pay może pomóc Ci podjąć świadomą decyzję. Znajdziesz tam recenzje użytkowników, szczegóły bonusów oraz informacje o wpłatach i wypłatach w kasynach akceptujących Revolut.

    People searching for gerçek canlı casino usually mean live-dealer roulette, blackjack, baccarat, or game-show tables streamed from a studio with a real dealer, rather than an RNG-only game. To assess authenticity, verify the operator’s licence directly with the regulator, check the named game provider and studio, look for clear rules and table limits, inspect withdrawal terms, and confirm that the service is legal in your jurisdiction; a foreign licence does not automatically make an operator legal in Türkiye.

    [canlı casino lisans rehberi](https://guvenilircanlicasinos.com/)[gerçek krupiyeli oyunlar](https://www.livecasinos.com/tr/) [guvenilircanlicasinos](https://guvenilircanlicasinos.com/)

    Many Dutch players now look for beste online casino iDEAL to benefit from secure iDEAL deposits, low minimum stakes, and quick withdrawals. These casinos integrate trusted Dutch payment infrastructure with streamlined cashout systems, ideal for users who value speed, simplicity, and transparent transactions. By consulting authentic player reviews, gamblers can identify sites that consistently deliver rapid payouts and a seamless gaming experience.

    Gli online casinos with bancoposta sono principalmente operatori che accettano la carta Visa o Mastercard collegata al conto BancoPosta per depositi e, in alcuni casi, prelievi. Tra i nomi più citati in Italia figurano 888casino, SNAI, LeoVegas, Planetwin365, Gioco Digitale, Sisal e StarCasinò, con depositi minimi spesso tra 10€ e 20€ e limiti massimi che possono arrivare a diverse migliaia di euro. Per utilizzare la carta, di solito basta selezionare Visa o Mastercard alla cassa, inserire i dati della carta BancoPosta e completare la verifica 3D Secure; i prelievi possono tornare sulla stessa carta o sul conto tramite bonifico, con tempi tipici da 24 ore a 3–5 giorni lavorativi.

    Gracze poszukujący sprawdzonych platform często wybierają kasyno niemcy, które oferuje przejrzyste zasady wypłat i bezpieczne metody płatności. Przed rejestracją warto porównać limity transakcji, czas realizacji przelewów oraz dostępne opcje wpłat, aby uniknąć niepotrzebnych opóźnień. Opinie innych użytkowników mogą pomóc ocenić rzetelność obsługi, jakość gier i ogólny komfort korzystania z platformy.

    Oferty określane jako zagraniczne kasyna bonus bez depozytu mogą obejmować darmowe spiny lub niewielkie środki promocyjne przyznawane po rejestracji i weryfikacji konta. Przed skorzystaniem z promocji należy dokładnie sprawdzić wymagania obrotu, maksymalną wypłatę, czas ważności bonusu oraz ograniczenia dla użytkowników z Polski. Zagraniczna licencja nie legalizuje automatycznie działalności hazardowej w Polsce, dlatego warto zweryfikować operatora w oficjalnych źródłach i grać odpowiedzialnie .