Pull in the cropper.js requirements. If in dev mode, bring in unminified.
@return void
427121
protected function requireFrontend() {
		$extension = Director::isLive() ? '.min' : '';
		$cssFiles = array(
			CROPPERFIELD_PATH . '/cropper/cropper' . $extension . '.css',
			CROPPERFIELD_PATH . '/cropper/CropperField.css',
		);
		$jsFiles = array(
			CROPPERFIELD_PATH . '/cropper/cropper' . $extension . '.js',
			CROPPERFIELD_PATH . '/cropper/CropperField.js',
		);
		Requirements::combine_files('cropperfield-all.css', $cssFiles);
		Requirements::combine_files('cropperfield-all.js', $jsFiles);
	}
349743
protected function renderEditor()
    {
        $html = '';

        // Will store the name
        $html .= $this->createHidden('name', $this->name);

        // Will store the crop coordinates
        $html .= $this->createHidden('crop_box',
            $this->image()->getAttributeValue('crop_box'));

        // Begin the image upload section
        $html .= '
			<div class="image-holder">
			<div class="toolbar input-group">
			<div class="btn-group btn-group-sm">
			<div class="crop btn js-tooltip active" title="' . __('decoy::form.image.crop_tooltip') . '">
			<div class="glyphicon glyphicon-scissors"></div></div>';

        // Will add the focal point ui
        if ($this->add_focal_point) {
            $html .= '<div class="focal btn js-tooltip" title="' . __('decoy::form.image.focal_tooltip') . '">
				<div class="glyphicon glyphicon-screenshot"></div></div>';

            // Will store the focal point
            $html .= $this->createHidden('focal_point',
                $this->image()->getAttributeValue('focal_point'));
        }

        // Will close out the button group
        $html .= '</div>';

        // Add the title input
        $html .= Former::text($this->inputName('title'))
            ->class('title js-tooltip')
            ->placeholder(__('decoy::form.image.title_placeholder'))
            ->title(__('decoy::form.image.title_help'))
            ->render();

        // Add delete button
        $html .= '<div class="delete btn-sm js-tooltip">
				<div class="glyphicon glyphicon-trash"></div>
			</div>';

        // Close out all divs and add image holder.  Make the old image no wider
        // than the max available width of forms (1050)
        if ($src = Former::getValue($this->inputName('file'))) {
            $src = Croppa::url($src, 1050);
        }

        $html .= sprintf('</div>
			<div class="preview"><img class="source" src="%s"></div>
			</div>', $src);

        return $html;
    }
724541
public function requireDefaultRecords() {
        parent::requireDefaultRecords();
        
        $defaultLangs=array_keys($this->defaultLanguages);
        $dbLangCount=SnippetLanguage::get()
                                        ->filter('Name', $defaultLangs)
                                        ->filter('UserLanguage', 0)
                                        ->Count();
        if($dbLangCount<count($defaultLangs)) {
            foreach($this->defaultLanguages as $name=>$data) {
                if(!SnippetLanguage::get()->find('Name', $name)) {
                    $lang=new SnippetLanguage();
                    $lang->Name=$name;
                    $lang->FileExtension=$data['Extension'];
                    $lang->HighlightCode=$data['HighlightCode'];
                    $lang->UserLanguage=false;
                    $lang->write();
                    
                    DB::alteration_message('Created snippet language "'.$name.'"', 'created');
                }
            }
        }
        
        
        //Look for config languages
        $configLanguages=CodeBank::config()->extra_languages;
        if(!empty($configLanguages)) {
            foreach($configLanguages as $language) {
                //Validate languages
                if(empty($language['Name']) || empty($language['FileName']) || empty($language['HighlightCode']) || empty($language['Brush'])) {
                    user_error('Invalid snippet user language found in config, user languages defined in config must contain a Name, FileName, HighlightCode and Brush file path', E_USER_WARNING);
                    continue;
                }
                
                
                $lang=SnippetLanguage::get()
                                            ->filter('Name', Convert::raw2sql($language['Name']))
                                            ->filter('HighlightCode', Convert::raw2sql($language['HighlightCode']))
                                            ->filter('UserLanguage', true)
                                            ->first();
                
                if(empty($lang) || $lang===false || $lang->ID<=0) {
                    if(Director::is_absolute($language['Brush']) || Director::is_absolute_url($language['Brush'])) {
                        user_error('Invalid snippet user language found in config, user languages defined in config must contain a path to the brush relative to the SilverStripe base ('.Director::baseFolder().')', E_USER_WARNING);
                        continue;
                    }
                    
                    if(preg_match('/\.js$/', $language['Brush'])==0) {
                        user_error('Invalid snippet user language found in config, user languages defined in config must be javascript files', E_USER_WARNING);
                        continue;
                    }
                    
                    
                    //Add language
                    $lang=new SnippetLanguage();
                    $lang->Name=$language['Name'];
                    $lang->FileExtension=$language['FileName'];
                    $lang->HighlightCode=$language['HighlightCode'];
                    $lang->BrushFile=$language['Brush'];
                    $lang->UserLanguage=true;
                    $lang->write();
                    
                    DB::alteration_message('Created snippet user language "'.$language['Name'].'"', 'created');
                }
            }
        }
    }
298514
public function registerScripts()
    {
        $view = $this->getView();

        Asset::register($view);
        if ($this->crop === true) {
            CropAsset::register($view);
        }

        $view->registerJs(
            'jQuery(\'#' . $this->getSelector() . '\').fileapi(' . Json::encode($this->settings) .');'
        );

        $this->registerCallbacks();
    }
1140713
public function loadRequirements()
    {
        // Load Required Themed JavaScript:
        
        if (ContentController::config()->load_themed_js) {
            
            foreach ($this->getRequiredThemedJS() as $js) {
                Requirements::themedJavascript($js);
            }
            
        }
        
        // Load Required Themed CSS:
        
        if (ContentController::config()->load_themed_css) {
            
            foreach ($this->getRequiredThemedCSS() as $css => $media) {
                Requirements::themedCSS($css, $media);
            }
            
        }
        
        // Load Required JavaScript:
        
        if (ContentController::config()->load_js) {
            
            foreach ($this->getRequiredJS() as $js) {
                Requirements::javascript($js);
            }
            
        }
        
        // Load Required CSS:
        
        if (ContentController::config()->load_css) {
            
            foreach ($this->getRequiredCSS() as $css => $media) {
                Requirements::css($css, $media);
            }
            
        }
        
        // Load Required Custom CSS:
        
        if (ContentController::config()->load_custom_css) {
            
            if ($css = $this->getCustomCSSAsString()) {
                Requirements::customCSS($css, $this->HTMLID);
            }
            
        }
        
        // Load Required JavaScript Templates:
        
        foreach ($this->getRequiredJSTemplates() as $file => $params) {
            ViewTools::singleton()->loadJSTemplate($file, $params['vars'], $params['id']);
        }
    }
97310
public function validate($args)
    {
        $e = $this->app->make('helper/validation/error');
        $f = File::getByID($args['fID']);
        $svg = false;
        if (is_object($f)) {
            $svg = $f->getTypeObject()->isSVG();
        }

        if (!$args['fID']) {
            $e->add(t('Please select an image.'));
        }

        if (isset($args['cropImage']) && ((int) $args['maxWidth'] <= 0 || ((int) $args['maxHeight'] <= 0)) && !$svg) {
            $e->add(t('Cropping an image requires setting a max width and max height.'));
        }

        if ($svg && isset($args['cropImage'])) {
            $e->add(t('SVG images cannot be cropped.'));
        }

        return $e;
    }
25775
public function run()
    {
        list($name, $id) = $this->resolveNameID();
        $id = $this->resolveId($id);

        if ($this->hasModel()) {
            echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
        } else {
            echo TbHtml::textField($name, $this->value, $this->htmlOptions);
        }

        if ($this->assetPath !== false) {
            $this->publishAssets($this->assetPath);
            $this->registerCssFile('/css/bootstrap-datetimepicker.css');

            if ($this->registerJs) {
                $this->registerScriptFile(
                    '/js/' . $this->resolveScriptVersion('bootstrap-datetimepicker.js'),
                    CClientScript::POS_END
                );

                if (isset($this->locale)) {
                    $this->locale = str_replace('_', '-', $this->locale);
                    $this->registerScriptFile(
                        "/js/locales/bootstrap-datetimepicker.{$this->locale}.js",
                        CClientScript::POS_END
                    );
                }
            }
        }

        if ($this->bindPlugin) {
            $options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '';
            $this->getClientScript()->registerScript(
                __CLASS__ . '#' . $id,
                "jQuery('#{$id}').datetimepicker({$options});"
            );
        }
    }
1157477
function(crop) {
            if(typeof crop === 'undefined') {
                crop = this._crop;
            }
            crop.usable = !crop.usable;
            this._renderUpdatedPreview(crop);

            if (crop.id === this._crop.id) {
                this._cropUsableToggle.on = crop.usable;
            }
        }
1178374
public function process()
	{
		$view = $this->getView();
		$context = $this->_getContext();

		try
		{
			/** client/html/basket/standard/require-stock
			 * Customers can order products only if there are enough products in stock
			 *
			 * @deprecated Use "client/html/basket/require-stock" instead
			 * @see client/html/basket/require-stock
			 */
			$reqstock = $view->config( 'client/html/basket/standard/require-stock', true );

			/** client/html/basket/standard/require-variant
			 * A variant of a selection product must be chosen
			 *
			 * @deprecated Use "client/html/basket/require-variant" instead
			 * @see client/html/basket/require-variant
			 */
			$reqvariant = $view->config( 'client/html/basket/standard/require-variant', true );

			$options = array(

				/** client/html/basket/require-stock
				 * Customers can order products only if there are enough products in stock
				 *
				 * Checks that the requested product quantity is in stock before
				 * the customer can add them to his basket and order them. If there
				 * are not enough products available, the customer will get a notice.
				 *
				 * @param boolean True if products must be in stock, false if products can be sold without stock
				 * @since 2014.03
				 * @category Developer
				 * @category User
				 */
				'stock' => $view->config( 'client/html/basket/require-stock', $reqstock ),

				/** client/html/basket/require-variant
				 * A variant of a selection product must be chosen
				 *
				 * Selection products normally consist of several article variants and by default
				 * exactly one article variant of a selection product can be put into the basket.
				 *
				 * By setting this option to false, the selection product including the chosen
				 * attributes (if any attribute values were selected) can be put into the basket
				 * as well. This makes it possible to get all articles or a subset of articles
				 * (e.g. all of a color) at once.
				 *
				 * @param boolean True if a variant must be chosen, false if also the selection product with attributes can be added
				 * @since 2014.03
				 * @category Developer
				 * @category User
				 */
				'variant' => $view->config( 'client/html/basket/require-variant', $reqvariant ),
			);

			switch( $view->param( 'b-action' ) )
			{
				case 'add':
					$this->_addProducts( $view, $options );
					break;
				case 'delete':
					$this->_deleteProducts( $view );
					break;
				default:
					$this->_editProducts( $view, $options );
			}

			parent::process();

			$controller = Controller_Frontend_Factory::createController( $context, 'basket' );
			$controller->get()->check( MShop_Order_Item_Base_Abstract::PARTS_PRODUCT );
		}
		catch( Client_Html_Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'client/html', $e->getMessage() ) );
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
		}
		catch( Controller_Frontend_Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
		}
		catch( MShop_Plugin_Provider_Exception $e )
		{
			$errors = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
			$errors = array_merge( $errors, $this->_translatePluginErrorCodes( $e->getErrorCodes() ) );

			$view->summaryErrorCodes = $e->getErrorCodes();
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors;
		}
		catch( MShop_Exception $e )
		{
			$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
		}
		catch( Exception $e )
		{
			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );

			$error = array( $context->getI18n()->dt( 'client/html', 'A non-recoverable error occured' ) );
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
		}
	}
309744
protected function getInput() {

        $this->requirejs = new RequireJSUtility();
        $this->modules = "";

        $options = $this->getOptions();

        // JS
        $js = "$('#" . $this->id . "').fileinput(" . json_encode($options) . ").on('filecleared', function() {
    \$('input[name=\"" . $this->name . "\"]').val('###DELETED###');
})";

        if (isset($this->element['uploadUrl'])) {
            $js .= ".on('fileuploaded', function(event, data, previewId, index) {
    \$('input[name=\"" . $this->name . "\"]').val(data.response.name);
})";
        }

        $js .= ";";

        // On ajoute les ressources.
        $this->requirejs
            ->addRequireJSModule("fileinput", "js/vendor/fileinput.min", true, array("jquery"))
            ->addDomReadyJS($js, false, "fileinput". $this->modules  .", css!/css/vendor/fileinput.min.css");

        // Initialize some field attributes.
        $accept = $this->element['accept'] ? ' accept="' . (string) $this->element['accept'] . '"' : '';
        $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
        $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
        $disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';

        // Initialize JavaScript field attributes.
        $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

        return '<input type="file" name="' . $this->fieldname . '_upload" id="' . $this->id . '"' . ' value=""' . $accept . $disabled . $class . $size
        . $onchange . '><input type="hidden" name="' . $this->name . '" data-fileinput="' . $this->id . '" value="' . $this->value . '">';

    }
603764
public function apply()
  {
    if (!empty($this->modificators)) {
      foreach ($this->modificators as $k => $mod) {
        switch ($mod['method']) {
          case static::RESIZE:
            $this->doResize($mod['width'], $mod['height']);
            break;
          case static::CROP:
            $this->doCrop($mod['width'], $mod['height'], $mod['x'], $mod['y']);
            break;
          case static::WATERMARK:
            $this->doWatermark($mod['file'], $mod['x'], $mod['y']);
            break;
          case static::CROP_RESIZED:
            $this->doCropResized($mod['width'], $mod['height'], $mod['x'], $mod['y']);
            break;
        }

        unset($this->modificators[$k]);
      }
    }

    return $this;
  }
1023485
public function processRequirements()
    {
        foreach ($this->requirements as $requirement)
        {
            if ( ! call_user_func($requirement, $this->resource, $this))
            {
                return false;
            }
        }

        return true;
    }
611145
public function requiredPollAnswers()
    {
        if ($this->pollAdded) {
            $this->pollAnswers = array_unique($this->pollAnswers);
            $filtered = [];
            foreach ($this->pollAnswers as $answer) {
                if (!empty(trim($answer))) {
                    $filtered[] = trim($answer);
                }
            }
            $this->pollAnswers = $filtered;
            if (count($this->pollAnswers) < 2) {
                $this->addError('pollAnswers', Yii::t('podium/view', 'You have to add at least 2 options.'));
            }
        }
    }
330386
public function validate(): void
    {
        $this->validateRootFilter();
        $this->validateRelations();
        $this->validateSorts();
        $this->validateOffset();
        $this->validateLimit();
        $this->validateFields();
    }
344918
function loadMonaco(monaco) {
		var deps = [
			'vs/editor/editor.main.nls',
			'vs/editor/editor.main'
		];

		charto.monaco = monaco;

		// Monaco loader sets exports, then gets confused by them.
		exports = void 0;

		return(new Promise(function(resolve, reject) {
			monaco.require(deps, resolve);
		}));
	}
881959
public function run() 
	{
		if ($this->documentor) {
			$this->documentor->setMethodData( $this->methods );
		}
		$request_xml = file_get_contents( 'php://input' );
		if ( !$request_xml ) 
		{
			if ( ( $query = $_SERVER['QUERY_STRING'] ) 
				&& isset($this->wsdl[$query]) && $this->wsdl[$query] )
			{
				header('Content-type: text/xml');
				header('Access-Control-Allow-Origin: *');
				echo $this->wsdl[$query];
			}
			else if ( $this->documentor )
			{
				header('Content-type: text/html; charset=' . $this->outputOptions['encoding']);
				$this->documentor->handle( $this, $this->methods );
			}
			else
			{
				// FIXME: add check for json-rpc protocol, if set and none of the xml protocols are set, use that
				header('Content-type: text/xml');
				header('Access-Control-Allow-Origin: *');
				echo xmlrpc_encode_request(
					null,  
					ripcord::fault( -1, 'No request xml found.' ),
					$this->outputOptions
				);
			}
		}
		else 
		{
			// FIXME: add check for the protocol of the request, could be json-rpc, then check if it is supported.
			header('Content-type: text/xml');
			header('Access-Control-Allow-Origin: *');
			echo $this->handle( $request_xml );
		}
	}
143023
protected function getCropTypes() {
    $croptypes = [
      'hero',
      'hero_small',
    ];

    $options = [];

    foreach ($croptypes as $croptype) {
      $type = CropType::load($croptype);
      if ($type instanceof CropType) {
        $options[$type->id()] = $type->label();
      }
    }

    return $options;
  }