MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/public_html/wp-content/plugins/imageseo/src/Services/Option.php
<?php

namespace ImageSeoWP\Services;

if (!defined('ABSPATH')) {
    exit;
}

use ImageSeoWP\Helpers\AltFormat;
use ImageSeoWP\Helpers\SocialMedia;

class Option
{
    /**
     * @var array
     */
    protected $optionsDefault = [
        'api_key'                       => '',
        'allowed'                       => false,
        'active_alt_write_upload'       => 1,
        'active_rename_write_upload'    => 1,
        'default_language_ia'           => 'en',
        'alt_template_default'          => AltFormat::ALT_SIMPLE,
        'social_media_post_types'       => [
            'post',
        ],
        'social_media_type'             => [
            SocialMedia::OPEN_GRAPH['name'],
        ],
        'social_media_settings'         => [
            'layout'                    => 'CARD_LEFT',
            'textColor'                 => '#000000',
            'contentBackgroundColor'    => '#ffffff',
            'starColor'                 => '#F8CA00',
            'visibilitySubTitle'        => true,
            'visibilitySubTitleTwo'     => true,
            'visibilityRating'          => false,
            'visibilityAvatar'          => true,
            'logoUrl'                   => IMAGESEO_URL_DIST . '/images/favicon.png',
            'defaultBgImg'              => IMAGESEO_URL_DIST . '/images/default_logo.png',
        ],
    ];

    /**
     * Get options default.
     *
     * @return array
     */
    public function getOptionsDefault()
    {
        return $this->optionsDefault;
    }

    /**
     * @return array
     */
    public function getOptions()
    {
        return apply_filters(
            'imageseo_get_options',
            wp_parse_args(get_option(IMAGESEO_SLUG), $this->getOptionsDefault())
        );
    }

    /**
     * @param string $name
     *
     * @return array
     */
    public function getOption($name)
    {
        $options = $this->getOptions();
        if (!array_key_exists($name, $options)) {
            return null;
        }

        return apply_filters('imageseo_' . $name . '_option', $options[$name]);
    }

    /**
     * @param array $options
     *
     * @return $this
     */
    public function setOptions($options)
    {
        update_option(IMAGESEO_SLUG, $options);

        return $this;
    }

    /**
     * @param string $key
     * @param mixed  $value
     *
     * @return $this
     */
    public function setOptionByKey($key, $value)
    {
        $options = $this->getOptions();
        $options[$key] = $value;
        $this->setOptions($options);

        return $this;
    }
}