• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
    • Help
      • Online help
      • Learn Git
      • Welcome to Bitbucket
      • Keyboard shortcuts
    • Log In
    Blackrock
    1. Blackrock

    main

    Public
    Actions
    • Clone

    Learn more about cloning repositories

    You have read-only access

    Navigation
    • Source
    • Commits
    • Branches
    • All Branches Graph
    • Graphs
    • Forks
    1. Blackrock
    2. main

    Source

    main/wp-content/plugins/sitepress-multilingual-cms/classes/url-handling/resolver/wpml-absolute-url-persisted.php
    Артем ШиряевАртем Ширяев committed 554847ddcb906 Apr 2021
    Raw file
    Source viewDiff to previous
         * @return string|false|null If the URL has already been processed but could not be resolved, it will return `false`
     
    1
    <?php
    2
    ​
    3
    class WPML_Absolute_Url_Persisted {
    4
    ​
    5
        const OPTION_KEY = 'wpml_resolved_url_persist';
    6
    ​
    7
        private static $instance;
    8
    ​
    9
        /**
    10
         * @var array
    11
         */
    12
        private $urls;
    13
    ​
    14
        /**
    15
         * @return WPML_Absolute_Url_Persisted
    16
         */
    17
        public static function get_instance() {
    18
            if ( null === self::$instance ) {
    19
                self::$instance = new self();
    20
            }
    21
    ​
    22
            return self::$instance;
    23
        }
    24
    ​
    25
        protected function __construct() {}
    26
    ​
    27
        private function __clone() {}
    28
    ​
    29
        /**
    30
         * @throws Exception
    31
         */
    32
        public function __wakeup() {
    33
            throw new Exception( 'Cannot unserialize singleton' );
    34
        }
    35
    ​
    36
        /**
    37
         * Returns urls array.
    38
         *
    39
         * @return array Array with urls.
    40
         */
    41
        private function get_urls() {
    42
            if ( null === $this->urls ) {
    43
                $this->urls = get_option( self::OPTION_KEY, array() );
    44
    ​
    45
                if ( ! is_array( $this->urls ) ) {
    46
                    $this->urls = array();
    47
                }
    48
            }
    49
    ​
    50
            return $this->urls;
    51
        }
    52
    ​
    53
        /** @return bool */
    54
        public function has_urls() {
    55
            return (bool) $this->get_urls();
    56
        }
    57
    ​
    58
        /**
    59
         * @param string       $original_url
    60
         * @param string       $lang
    61
         * @param string|false $converted_url A `false` value means that the URL could not be resolved
    62
         */
    63
        public function set( $original_url, $lang, $converted_url ) {
    • Git repository management for enterprise teams powered by Atlassian Bitbucket
    • Atlassian Bitbucket v5.10.1
    • Documentation
    • Contact Support
    • Request a feature
    • About
    • Contact Atlassian
    Atlassian

    Everything looks good. Well let you know here if theres anything you should know about.