Include available includes

@return Array
514748
protected function includeAvailableIncludes($model, $data )
    {

        // Get available includes from url parameters
        $includes = $this->getAvailableIncludesFromUrlParameters();

        // Create an return array
        $returnData = [];

        // Check if we have includes and include parameter values
        if ( ! empty( $includes ) && ! empty( $this->availableIncludes ) ) {

            // Loop through all includes
            foreach ($this->availableIncludes as $include) {

                // If the words exists in both includes
                if ( in_array( $include, $includes ) ) {

                    // Add the new data
                    $returnData[ $include ] = $this->includeByName( $include, $model );

                }
            }
        }

        // Return data
        return array_merge( $data, $returnData );
    }
1210064
protected function GetIncludes()
    {
        Requirements::combine_files(
            'frontend-lib.js',
            array(
            THIRDPARTY_DIR.'/jquery/jquery.js',
            FRAMEWORK_DIR.'/javascript/jquery-ondemand/jquery.ondemand.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/lib.js',
            THIRDPARTY_DIR.'/jquery-ui/jquery-ui.js',
//            THIRDPARTY_DIR . '/json-js/json2.js',
            THIRDPARTY_DIR.'/jquery-entwine/dist/jquery.entwine-dist.js',
//            THIRDPARTY_DIR . '/jquery-cookie/jquery.cookie.js',
            THIRDPARTY_DIR.'/jquery-query/jquery.query.js',
            THIRDPARTY_DIR.'/jquery-form/jquery.form.js',
            FRAMEWORK_ADMIN_DIR.'/thirdparty/jquery-notice/jquery.notice.js',
//            FRAMEWORK_ADMIN_DIR . '/thirdparty/jsizes/lib/jquery.sizes.js',
            FRAMEWORK_ADMIN_DIR.'/thirdparty/jlayout/lib/jlayout.border.js',
            FRAMEWORK_ADMIN_DIR.'/thirdparty/jlayout/lib/jquery.jlayout.js',
//            FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.js',
//            FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.adapter.jquery.js',
//            FRAMEWORK_ADMIN_DIR . '/thirdparty/history-js/scripts/uncompressed/history.html4.js',
//            THIRDPARTY_DIR . '/jstree/jquery.jstree.js',
            FRAMEWORK_ADMIN_DIR.'/thirdparty/chosen/chosen/chosen.jquery.js',
            FRAMEWORK_ADMIN_DIR.'/thirdparty/jquery-hoverIntent/jquery.hoverIntent.js',
//            FRAMEWORK_ADMIN_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js',
            FRAMEWORK_DIR.'/javascript/i18n.js',
//            FRAMEWORK_DIR . '/javascript/TreeDropdownField.js',
//            FRAMEWORK_DIR . '/javascript/DateField.js',
            FRAMEWORK_DIR.'/javascript/HtmlEditorField.js',
//            FRAMEWORK_DIR . '/javascript/TabSet.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/ssui.core.js',
//            FRAMEWORK_DIR . '/javascript/GridField.js',
            )
        );
        Requirements::combine_files(
            'frontend-cmsmain.js',
            array_merge(
                array(
            CMS_DIR.'/javascript/CMSMain.js',
            CMS_DIR.'/javascript/CMSMain.EditForm.js',
            CMS_DIR.'/javascript/CMSMain.AddForm.js',
            CMS_DIR.'/javascript/CMSPageHistoryController.js',
            CMS_DIR.'/javascript/CMSMain.Tree.js',
            CMS_DIR.'/javascript/SilverStripeNavigator.js',
            CMS_DIR.'/javascript/SiteTreeURLSegmentField.js'
                ), Requirements::add_i18n_javascript(CMS_DIR.'/javascript/lang', true, true)
            )
        );

        $leftAndMainIncludes = array_unique(array_merge(
                array(
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.Layout.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.ActionTabSet.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.Panel.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.Tree.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.Content.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.EditForm.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.Menu.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.Preview.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.BatchActions.js',
            FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.FieldHelp.js',
//            FRAMEWORK_ADMIN_DIR . '/javascript/LeftAndMain.TreeDropdownField.js',
                ), Requirements::add_i18n_javascript(FRAMEWORK_DIR.'/javascript/lang', true, true),
                                                     Requirements::add_i18n_javascript(FRAMEWORK_ADMIN_DIR.'/javascript/lang', true, true)
        ));

        if ($this->config()->session_keepalive_ping) {
            $leftAndMainIncludes[] = FRAMEWORK_ADMIN_DIR.'/javascript/LeftAndMain.Ping.js';
        }

        $jsMin = (Director::isDev()) ? "" : ".min";
        Requirements::javascript(FRONTEND_ADMIN_DIR.'/javascript/dist/FrontEndEditorToolbar'.$jsMin.'.js');
        Requirements::css(FRAMEWORK_ADMIN_DIR.'/thirdparty/chosen/chosen/chosen.css');
        Requirements::css(FRAMEWORK_DIR.'/thirdparty/jquery-ui-themes/smoothness/jquery-ui.css');
        Requirements::css(CMS_DIR."/css/screen.css");
        Requirements::css(FRAMEWORK_DIR.'/css/AssetUploadField.css');
        Requirements::css(FRAMEWORK_DIR.'/css/UploadField.css');
        Requirements::css(FRAMEWORK_ADMIN_DIR."/css/screen.css");
    }
302586
public function set_includes() {

		$this->includes = apply_filters( 'ctc_includes', array(

			// Frontend or admin
			'always' => array(

				// Functions
				CTC_INC_DIR . '/add-ons.php',
				CTC_INC_DIR . '/event-fields.php',
				CTC_INC_DIR . '/helpers.php',
				CTC_INC_DIR . '/mime-types.php',
				CTC_INC_DIR . '/page-nav.php',
				CTC_INC_DIR . '/post-types.php',
				CTC_INC_DIR . '/schedule.php',
				CTC_INC_DIR . '/support.php',
				CTC_INC_DIR . '/taxonomies.php',

				// Classes
				CTC_CLASS_DIR . '/ct-recurrence.php',

			),

			// Admin only
			'admin' => array(

				// Functions
				CTC_ADMIN_DIR . '/activation.php',
				CTC_ADMIN_DIR . '/admin-enqueue-styles.php',
				CTC_ADMIN_DIR . '/admin-event-fields.php',
				CTC_ADMIN_DIR . '/admin-helpers.php',
				CTC_ADMIN_DIR . '/admin-location-fields.php',
				CTC_ADMIN_DIR . '/admin-menu.php',
				CTC_ADMIN_DIR . '/admin-person-fields.php',
				CTC_ADMIN_DIR . '/admin-posts.php',
				CTC_ADMIN_DIR . '/admin-sermon-fields.php',
				CTC_ADMIN_DIR . '/admin-support.php',
				CTC_ADMIN_DIR . '/import.php',

				// Libraries
				CTC_LIB_DIR . '/ct-meta-box/ct-meta-box.php', // see CTMB_URL constant defined above

			),

			// Frontend only
			/*
			'frontend' => array (

			),
			*/

		) );

	}
413151
public function getInstallers()
    {
        $this->orderedInstallers = [];

        if ($this->orderInstallersByNumber) {
            $this->orderInstallersByNumber();
        }

        if ($this->orderInstallersByDependencies) {
            $this->orderInstallersByDependencies();
        }

        if (!$this->orderInstallersByNumber && !$this->orderInstallersByDependencies) {
            $this->orderedInstallers = $this->installers;
        }

        return $this->orderedInstallers;
    }
1057151
protected function getExcludedTables()
	{
		$excludes = ['migrations'];
		$ignore = $this->option('ignore');
		if ( ! empty($ignore)) {
			return array_merge($excludes, explode(',', $ignore));
		}

		return $excludes;
	}
729361
public function getSimpleData($include_header = true)
	{
		$return = [];

		if ($include_header) {
			$return[] = $this->getHeader();
		}

		foreach ($this->data as $item) {
			$return[] = $this->getRow($item);
		}

		return $return;
	}
1094581
protected function parseIncludes(array $includes)
    {
        $return = [
            'includes' => [],
            'modes' => []
        ];

        foreach ($includes as $include) {
            $explode = explode(':', $include);

            if (!isset($explode[1])) {
                $explode[1] = $this->defaults['mode'];
            }

            $return['includes'][] = $explode[0];
            $return['modes'][$explode[0]] = $explode[1];
        }

        return $return;
    }
1222796
public function addIncludes($includes)
	{
		if($includes instanceof Model)
		{
			$this->addItemToInclude($includes);
		}
		else
		{
			foreach ($includes as $item)
			{
				$this->addItemToInclude($item);
			}
		}
		
		if($includes instanceof DataTransferObject)
		{
			$this->addIncludes($includes->getIncludes());
		}

		if($this instanceof Collection)
		{
			foreach ($this->data as $model)
			{
				$model->addIncludes($includes);
			}
		}
	}
1307387
protected function getAvailableModules()
    {
        $removeModules = array('MelisInstaller', 'MelisSites', 'MelisAssetManager', 'MelisDesign');
        $availableModules = $this->getModuleSvc()->getAllModules();
        $modules = array();

        $mm            = $this->getServiceLocator()->get('ModuleManager');
        $activeModules = array_keys($mm->getLoadedModules());

        foreach ($availableModules as $module) {
            if (!in_array($module, $removeModules)) {
                if(in_array($module, $activeModules)) {
                    $modules[] = $module;
                }

            }
        }
        return $modules;
    }
1068508
public static function getAvailableList($includeConcreteDirJobs = 1)
    {
        $jobObjs = array();

        //get existing jobs
        $existingJobHandles = array();
        $existingJobs = static::getList();
        foreach ($existingJobs as $j) {
            $existingJobHandles[] = $j->getJobHandle();
        }

        if (!$includeConcreteDirJobs) {
            $jobClassLocations = array(DIR_FILES_JOBS);
        } else {
            $jobClassLocations = static::jobClassLocations();
        }

        foreach ($jobClassLocations as $jobClassLocation) {
            // Open a known directory, and proceed to read its contents
            if (is_dir($jobClassLocation)) {
                if ($dh = opendir($jobClassLocation)) {
                    while (($file = readdir($dh)) !== false) {
                        if (substr($file, strlen($file) - 4) != '.php') {
                            continue;
                        }

                        $alreadyInstalled = 0;
                        foreach ($existingJobHandles as $existingJobHandle) {
                            if (substr($file, 0, strlen($file) - 4) == $existingJobHandle) {
                                $alreadyInstalled = 1;
                                break;
                            }
                        }
                        if ($alreadyInstalled) {
                            continue;
                        }

                        $jHandle = substr($file, 0, strlen($file) - 4);
                        $className = static::getClassName($jHandle);
                        $jobObjs[$jHandle] = Core::make($className);
                        $jobObjs[$jHandle]->jHandle = $jHandle;
                    }
                    closedir($dh);
                }
            }
        }

        return $jobObjs;
    }
307212
protected function processIncludes()
    {
        foreach ($this->getXml()->xpath('/includes/include[@type != "" and @file != ""]') as $include) {
            $processor = $this->getIncludeProcessor((string)$include['type']);
            if (!$processor) {
                trigger_error(sprintf('No include processor for "%s" available. Did you forget to register it?', (string)$include['type']), E_USER_WARNING);
                continue;
            }

            $file = $this->getModulePath((string)$include['file']);
            $processor->load($file, $this->manifest);
        }

        return $this;
    }
1303345
protected function miscellaneous(): array
    {
        return array_filter([
            'X-Content-Type-Options' => $this->config['x-content-type-options'],
            'X-Download-Options' => $this->config['x-download-options'],
            'X-Frame-Options' => $this->config['x-frame-options'],
            'X-Permitted-Cross-Domain-Policies' => $this->config['x-permitted-cross-domain-policies'],
            'X-XSS-Protection' => $this->config['x-xss-protection'],
            'Referrer-Policy' => $this->config['referrer-policy'],
            'Server' => $this->config['server'] ?? '',
        ]);
    }
468121
protected function includeAssets()
    {
        $sPluginOptionName = 'assets.include.' . $this->getName();
        if($this->hasOption($sPluginOptionName) && !$this->getOption($sPluginOptionName))
        {
            return false;
        }
        if($this->hasOption('assets.include.all') && !$this->getOption('assets.include.all'))
        {
            return false;
        }
        return true;
    }
833008
def includes(self):
        """"""

        incs = self.combined_properties('includes')

        processed_incs = []
        for prop in incs:
            if isinstance(prop, str):
                processed_incs.append(prop)
            else:
                processed_incs.append(os.path.join(*prop))

        # All include paths are relative to base directory of the
        fullpaths = [os.path.normpath(os.path.join('.', x)) for x in processed_incs]
        fullpaths.append(os.path.normpath(os.path.abspath(self.build_dirs()['build'])))

        return fullpaths
414014
protected function getAvailableFilters()
    {
        $filters = [];

        foreach ($this->config['allowed_filters'] as $key) {
            if (!isset($this->filterSets[$key])) {
                continue;
            }

            $set = $this->filterSets[$key];

            $explanation = [];
            foreach ($set['filters'] as $filter => $properties) {
                switch ($filter) {
                    case 'thumbnail':
                        $explanation[] = $properties['size'][0].' X '. $properties['size'][0];
                        break;
                    case 'relative_resize':
                        $heighten = (isset($properties['heighten'])) ? $properties['heighten'] : '~';
                        $widen = (isset($properties['widen'])) ? $properties['widen'] : '~';
                        $explanation[] = $widen.' X '.$heighten;
                        break;
                }
            }
            $filters[$key . ' ('.implode(', ', $explanation).')'] = $key;
        }

        return $filters;
    }
441760
public function getAvailableThemePaths()
    {
        $paths      = [];
        $themePaths = $this->getThemePaths();

        foreach ($themePaths as $path) {
            $this->files->isDirectory(base_path($path)) && $paths[] = base_path($path);
        }

        return $paths;
    }
595241
protected function getRawIncludeMap(): array
    {
        $map = [];

        foreach ($this->includes as $includeKey => $definition) {
            if (\is_int($includeKey)) {
                $includeKey = $definition;
                $definition = null;
            }

            $settings = [];
            if (!empty($definition)) {
                $parts = preg_split('/\s*\|\s*/', $definition);
                foreach ($parts as $part) {
                    if (!preg_match('/^([^:]+)(:(.+))?$/', $part, $match)) {
                        throw new ParseDefinitionException("Unable to parse field definition for '{$includeKey}''");
                    }
                    // If only list() was viable ...
                    $directive = $match[1];
                    $val = $match[3] ?? null;
                    switch ($directive) {
                        case 'default':
                            $settings['default'] = true;
                            break;
                        case 'relation':
                            $settings['relation'] = !empty($val) ?
                                preg_split('/s*,\s*/', $val) : [$includeKey];
                            break;
                        case 'method':
                            if (!empty($val)) {
                                $settings['method'] = $val;
                            }
                            break;
                        case 'item':
                            $settings['resource_type'] = 'item';
                            break;
                        case 'collection':
                            $settings['resource_type'] = 'collection';
                            break;
                        default:
                            throw new ParseDefinitionException("Invalid key '{$directive}' for {$includeKey}");
                    }
                }
            }

            if (!isset($settings['relation'])) {
                $settings['relation'] = [];
            }
            if (!isset($settings['method'])) {
                $settings['method'] = 'include'.StrHelper::studlyCase($includeKey);
            }
            if (!isset($settings['default'])) {
                $settings['default'] = false;
            }
            if (!isset($settings['resource_type'])) {
                $settings['resource_type'] = null;
            }

            $map[$includeKey] = $settings;
        }

        return $map;
    }