Fetches current archive slug
@return mixed (string, boolean) False if not archive else archive slug
486018
public static function getArchiveSlug()
    {
        global $wp_query;

        if ($wp_query && !is_tax() && (is_post_type_archive() || is_archive() || is_home() || is_search() || is_404())) {
            $postType = get_post_type();

            if (isset($wp_query->query_vars['post_type']) && !empty($wp_query->query_vars['post_type'])) {
                $postType = $wp_query->query_vars['post_type'];
            }

            if (is_home()) {
                $archiveSlug = 'archive-post';
            } elseif (is_post_type_archive() && is_search()) {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            } elseif (is_search()) {
                $archiveSlug = 'search';
            } elseif (is_404()) {
                $archiveSlug = 'e404';
            } elseif (is_author()) {
                $archiveSlug = 'author';
            } else {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            }

            return $archiveSlug;
        }

        return false;
    }
76710
public function getPath(): array {

        return array_column(
            array_map(function($key, $archive) {
                return [ "key" => $key, "path" => $archive->getPath() ];
            }, array_keys($this->zip_archives), $this->zip_archives),
        "path", "key");

    }
144472
protected function getNewRepositoryUrl()
    {
        try {
            $this->getRemoteContents($this->getRepositoryUrl());
            $headers = $this->remoteFilesystem->getLastHeaders();

            if (!empty($headers[0]) && preg_match('{^HTTP/\S+ (30[1278])}i', $headers[0], $match)) {
                array_shift($headers);

                return $this->findNewLocationInHeader($headers);
            }

            return false;
        } catch (\Exception $ex) {
            return false;
        }
    }
743782
protected function _fetch() {
		if (!$this->_resource) {
			return false;
		}
		if (!$this->_resource->hasNext()) {
			return null;
		}
		$result = $this->_resource->getNext();

		if ($result instanceof MongoGridFSFile) {
			$result = ['file' => $result] + $result->file;
		}
		return [$this->_iterator, $result];
	}
1223829
public function update_archive_slug( $args, $post_type ) {
		if ( $post_type !== $this->post_type ) {
			return $args;
		}

		$args['has_archive'] = trim(
			wp_make_link_relative( get_permalink( $this->post_id ) ),
			'/'
		);

		return $args;
	}
847979
protected function extractArchive($archiveFile)
    {
        $archiveDir    = dirname($archiveFile);
        $archiveObj    = new ZipArchive();
        $archiveHandle = $archiveObj->open($archiveFile);
        if (true !== $archiveHandle) {
            return array('error' => __('Could not open archive'));
        }

        if (!$archiveObj->extractTo($archiveDir)) {
            $archiveObj->close();
            return array('error' => __('Could not extract archive'));
        }
        $archiveObj->close();
        return $archiveDir;
    }
692020
public function getCurrentUploadDir()
    {
        if (! isset($this->currentUploadDir)) {
            $modelDir = $this->getIdentifier();
            $this->currentUploadDir = public_path($this->uploadDir).DIRECTORY_SEPARATOR.$modelDir.
                DIRECTORY_SEPARATOR.$this->getKey().DIRECTORY_SEPARATOR;
        }

        return $this->currentUploadDir;
    }
301867
public function getArchive()
    {
        $format = ($this->ArchiveType == 'Yearly') ? '%Y' : '%Y-%m';
        $publishDate = DB::get_conn()->formattedDatetimeClause('"PublishDate"', $format);
        $fields = [
            'PublishDate' => $publishDate,
            'Total' => "COUNT('\"PublishDate\"')"
        ];

        $stage = Versioned::get_stage();
        $suffix = ($stage === Versioned::LIVE) ? '_' . Versioned::LIVE : '';
        $query = SQLSelect::create($fields, '"BlogPost' . $suffix . '"')
            ->addGroupBy($publishDate)
            ->addOrderBy('"PublishDate" DESC')
            ->addWhere(['"PublishDate" <= ?' => DBDatetime::now()->Format(DBDatetime::ISO_DATETIME)]);

        $posts = $query->execute();
        $result = ArrayList::create();
        foreach ($posts as $post) {
            if ($this->ArchiveType == 'Yearly') {
                $year  = $post['PublishDate'];
                $month = null;
                $title = $year;
            } else {
                $date = DBDate::create();
                $date->setValue(strtotime($post['PublishDate']));

                $year  = $date->Format('y');
                $month = $date->Format('MM');
                $title = $date->Format('MMMM y');
            }

            $result->push(ArrayData::create([
                'Title' => $title,
                'Link' => Controller::join_links($this->Blog()->Link('archive'), $year, $month)
            ]));
        }

        $this->extend('updateGetArchive', $result);

        return $result;
    }
977562
def get_url(self):
        
        return os.path.join(
            '/archive',
            self.get_year(),
            self.get_month(),
            self.get_day()
        )
902771
public function get( $option, $slug ) {

		if ( $this->is_active() ) {

			$this->prepare( $slug );

			$slug = $this->slug;

			if ( isset( $this->plugin[ $slug ][ $option ] ) ) {
				return $this->plugin[ $slug ][ $option ];
			} elseif ( '*' == $option && isset( $this->plugin[ $slug ] ) ) {
				return $this->plugin[ $slug ];
			}

			return false;
		}
	}
106754
protected function archive()
    {
        if( $archiveDatabaseList = $this->getArchiveDatabaseList() )
        {
            foreach( $archiveDatabaseList as $database )
            {
                if( ! empty($tables = $this->getArchiveDatabaseTableList($database)) )
                {
                    $dbForge = $this->getDBForgeDifferentConnectionByDatabaseName($database);
    
                    foreach( $tables as $table )
                    {
                        $dbForge->dropTable($this->getTableNameWithoutExtension($table));
                    }
                }
    
                $tool = $this->getDBToolDifferentConnectionByDatabaseName($database);
    
                if( empty($tool->listTables()) )
                {
                    $this->forge->dropDatabase($database);
                }
            }

            return true;
        }
        
        return false;
    }
598660
public function get_value() {
		$data = $this->get_data();
		if ( isset( $data[ $this->slug ] ) ) {
			$data = $data[ $this->slug ];
		}

		return $data;
	}
632285
public function get($archiverId, $isAvailable = null)
    {
        $this->has($archiverId, true);

        if ($isAvailable === null) {
            return $this->archivers[$archiverId];
        }

        if ($this->archivers[$archiverId]->isAvailable() === (bool) $isAvailable) {
            return $this->archivers[$archiverId];
        }

        return null;
    }
486062
public function fetch()
    {
        if (! $this->valid()) {
            return false;
        }
        $line = $this->current();
        $this->readLine();
        return $line;
    }
713847
public function getExistingSlugs($slug)
    {
        return self::select('slug')->where('slug', 'like', $slug.'%')
            ->when($this->id, function ($query) {
                return $query->where('id', '<>', $this->id);
            })
            ->get();
    }
590779
private function getDelayBetweenPeriodsArchives()
    {
        if (empty($this->forceTimeoutPeriod)) {
            return self::SECONDS_DELAY_BETWEEN_PERIOD_ARCHIVES;
        }

        // Ensure the cache for periods is at least as high as cache for today
        if ($this->forceTimeoutPeriod > $this->todayArchiveTimeToLive) {
            return $this->forceTimeoutPeriod;
        }

        $this->logger->info("WARNING: Automatically increasing --force-timeout-for-periods from {$this->forceTimeoutPeriod} to "
            . $this->todayArchiveTimeToLive
            . " to match the cache timeout for Today's report specified in Matomo UI > Settings > General Settings");

        return $this->todayArchiveTimeToLive;
    }
89371
protected function getCurrentPage()
    {
        if (is_post_type_archive()) {
            $pageForPostType = get_option('page_for_' . get_post_type());
            return get_post($pageForPostType);
        }

        global $post;

        if (!is_object($post)) {
            return get_queried_object();
        }

        return $post;
    }