sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function execute($returnTransfer = TRUE) { //Need transfer return if($returnTransfer === TRUE) { $this->setOption(CURLOPT_RETURNTRANSFER, 1); } $result = curl_exec($this->handler); //Error handling if(curl_errno($this->handler)) { $format = [curl_errno($this->handler), curl_error($this->handler)]; $this->close(); throw RuntimeException::createByFormat('Error executing request, error code: %s, Message: %s', $format); } return $result; }
Execute the prepared request and optionally returns the response @param bool $returnTransfer Returns the returned response @throws \BuildR\Foundation\Exception\RuntimeException @return array|\stdClass @codeCoverageIgnore
entailment
public function pushEndpointHandler($apiName, $handlerClassName) { if(!class_exists($handlerClassName)) { throw new RuntimeException('This handler class (' . $handlerClassName . ') not found!'); } $apiName = ucfirst(strtolower($apiName)); $this->uniqueEndpointHandlers[$apiName] = $handlerClassName; //Invalidate the cache, if exist if(isset($this->endpointObjectCache[$apiName])) { unset($this->endpointObjectCache[$apiName]); } }
Pushes a unique handler to the stack. Unique handlers are preferred, over default handlers. One endpoint only have on unique handler, and if you push another it will overwrite the previous @param string $apiName @param string $handlerClassName The handler FQCN @throws \BuildR\Foundation\Exception\RuntimeException
entailment
protected function getEndpointHandler($apiName, ReflectionClass $endpointReflector) { if(isset($this->endpointObjectCache[$apiName])) { return $this->endpointObjectCache[$apiName]; } //Create a new instance and store it $endpointInstance = $endpointReflector->newInstanceArgs([$this->getClient()]); $this->endpointObjectCache[$apiName] = $endpointInstance; return $endpointInstance; }
Returns a new instance from the given endpoint handler. In the instance creation the client is passed to tha handler as parameter. This method also do runtime caching. All endpoint handler cached by name @param string $apiName Used as cache key name @param \ReflectionClass $endpointReflector @return \Phabricator\Endpoints\EndpointInterface
entailment
protected function getExecutorMethod($methodName, ReflectionClass $endpointReflector) { $neededMethod = strtolower($methodName) . "Executor"; if(!$endpointReflector->hasMethod($neededMethod)) { $neededMethod = "defaultExecutor"; } return $endpointReflector->getMethod($neededMethod); }
Return the reflector of the method that can execute the query on the endpoint. @param string $methodName Like "query" @param \ReflectionClass $endpointReflector @return \ReflectionMethod
entailment
protected function getHandlerClassName($apiName) { $apiName = ucfirst(strtolower($apiName)); $neededClass = __NAMESPACE__ . '\\' . 'Endpoints\\Defaults\\' . $apiName; if(isset($this->uniqueEndpointHandlers[$apiName])) { $neededClass = $this->uniqueEndpointHandlers[$apiName]; } return $neededClass; }
Returns the FQCN of the handler class. Returns the default handler if no unique handler available for the given endpoint. @param string $apiName Like "Project" @return string
entailment
protected function getDataByArguments(array $arguments) { if(!isset($arguments[0])) { throw new RuntimeException('The arguments not contains the method name!'); } $methodName = (string) $arguments[0]; $methodArgs = []; if(isset($arguments[1]) && is_array($arguments[1])) { $methodArgs = $arguments[1]; } return [ 'methodName' => $methodName, 'methodArgs' => $methodArgs, ]; }
Get the base date by the passed array. The returned array contains the method name (on endpoint) and the arguments that the called method can give. Returned array keys: - (string) methodName - (array) methodArgs @param array $arguments The magic method argument array @throws \BuildR\Foundation\Exception\RuntimeException @return array
entailment
public function check(Request $request) { $this->response = $this->verify($request->input('g-recaptcha-response'), $request->ip()); return $this; }
Verify captcha @param \Illuminate\Http\Request $request @return $this
entailment
private function getMemory() { $memory = shmop_open($this->key, "c", 0644, self::LIMIT); if (!$memory) { throw new Exception("Unable to open the shared memory block"); } return $memory; }
Get the shared memory segment. @return resource
entailment
private function unserialize($memory): array { $data = shmop_read($memory, 0, self::LIMIT); $exceptions = unserialize($data); if (!is_array($exceptions)) { $exceptions = []; } return $exceptions; }
Get the exception details out of shared memory. @param resource $memory The shmop resource from shmop_open() @return \Throwable[]
entailment
public function addException(\Throwable $exception) { $memory = $this->getMemory(); $exceptions = $this->unserialize($memory); $exceptions[] = get_class($exception) . ": " . $exception->getMessage() . " (" . $exception->getFile() . ":" . $exception->getLine() . ")"; $data = serialize($exceptions); shmop_write($memory, $data, 0); shmop_close($memory); }
Add an exception the shared memory. @param \Throwable $exception The exception instance to add @return void
entailment
public function getExceptions(): array { $memory = $this->getMemory(); $exceptions = $this->unserialize($memory); shmop_write($memory, serialize([]), 0); shmop_close($memory); return $exceptions; }
Get all the exceptions added to the shared memory. @return \Throwable[]
entailment
public function delete() { $memory = shmop_open($this->key, "a", 0, 0); if ($memory) { shmop_delete($memory); shmop_close($memory); } }
Delete the shared memory this instance represents. @return void
entailment
public function getGridCols() { $arrColumns = array(); // columns if($GLOBALS['EUF_GRID_SETTING']['cols']) { foreach($GLOBALS['EUF_GRID_SETTING']['cols'] as $option) { foreach ($GLOBALS['EUF_GRID_SETTING']['viewports'] as $viewport) { foreach($GLOBALS['EUF_GRID_SETTING']['columns'] as $column) { $arrColumns[$option.$GLOBALS['EUF_GRID_SETTING']['devider'].$viewport][] = $option.$GLOBALS['EUF_GRID_SETTING']['devider'].$viewport.$GLOBALS['EUF_GRID_SETTING']['devider'].$column; } } } } return $arrColumns; }
Optionen für Select-Feld 'Grid-Spalten' aus config laden und zusammenbauen
entailment
public function getGridOptions() { $arrOptions = array(); // Offset if($GLOBALS['EUF_GRID_SETTING']['offset']) { foreach($GLOBALS['EUF_GRID_SETTING']['offset'] as $option) { foreach ($GLOBALS['EUF_GRID_SETTING']['viewports'] as $viewport) { foreach($GLOBALS['EUF_GRID_SETTING']['offset_cols'] as $column) { $arrOptions[$option.$GLOBALS['EUF_GRID_SETTING']['devider'].$viewport][] = $option.$GLOBALS['EUF_GRID_SETTING']['devider'].$viewport.$GLOBALS['EUF_GRID_SETTING']['devider'].$column; } } } } // Pulls if($GLOBALS['EUF_GRID_SETTING']['pulls']) { foreach($GLOBALS['EUF_GRID_SETTING']['pulls'] as $option) { foreach ($GLOBALS['EUF_GRID_SETTING']['viewports'] as $viewport) { $arrOptions[$option][] = $option.$GLOBALS['EUF_GRID_SETTING']['devider'].$viewport; } } } // Resets if($GLOBALS['EUF_GRID_SETTING']['resets']) { foreach($GLOBALS['EUF_GRID_SETTING']['resets'] as $option) { foreach ($GLOBALS['EUF_GRID_SETTING']['viewports'] as $viewport) { $arrOptions[$option][] = $option.$GLOBALS['EUF_GRID_SETTING']['devider'].$viewport; } } } // further Options if($GLOBALS['EUF_GRID_SETTING']['options']) { foreach($GLOBALS['EUF_GRID_SETTING']['options'] as $option) { $arrOptions[$GLOBALS['TL_LANG']['tl_content']['grid_further_options']][] = $option; } } return $arrOptions; }
Optionen für Select-Feld 'Grid-Optionen' aus config laden und zusammenbauen
entailment
public static function addClassesToLabels($arrRow, $return) { // Grid-Klassen dem Typ hinzufügen $grid = "("; if($arrRow['grid_columns'] != "" ) { $strField = "grid_columns"; $env = "BE"; $arrGridClasses = deserialize($arrRow['grid_columns']); // HOOK: create and manipulate grid classes if (isset($GLOBALS['TL_HOOKS']['manipulateGridClasses']) && is_array($GLOBALS['TL_HOOKS']['manipulateGridClasses'])) { foreach ($GLOBALS['TL_HOOKS']['manipulateGridClasses'] as $callback) { $this->import($callback[0]); $arrGridClassesManipulated = array(); foreach ($arrGridClasses as $class) { $arrGridClassesManipulated[] = $this->{$callback[0]}->{$callback[1]}($env, $strField, $class); } $arrGridClasses = $arrGridClassesManipulated; } } $grid .= implode(deserialize($arrGridClasses), ", "); if($arrRow['grid_options'] != "" ) { $grid .= ", "; } } if($arrRow['grid_options'] != "" ) { $env = "BE"; $strField = "grid_options"; $arrGridClasses = deserialize($arrRow['grid_options']); // HOOK: create and manipulate grid classes if (isset($GLOBALS['TL_HOOKS']['manipulateGridClasses']) && is_array($GLOBALS['TL_HOOKS']['manipulateGridClasses'])) { foreach ($GLOBALS['TL_HOOKS']['manipulateGridClasses'] as $callback) { $this->import($callback[0]); $arrGridClassesManipulated = array(); foreach ($arrGridClasses as $class) { $arrGridClassesManipulated[] = $this->{$callback[0]}->{$callback[1]}($env, $strField, $class); } $arrGridClasses = $arrGridClassesManipulated; } } $grid .= implode(deserialize($arrGridClasses), ", "); } // close classes $grid .= ")"; if($arrRow['grid_columns'] == "" && $arrRow['grid_options'] == "") { $grid = ""; } // Klasse hinzufügen, wenn $grid gesetzt if($grid!=="") { $type .= " <span class='tl_gray'>".$grid."</span>"; $return .= '<div class="tl_gray tl_content_right">'.$grid.'</div>'; } return $return; }
Funktion zum Anzeigen der Grid-Klassen in der Übersicht im BE
entailment
protected function addLogosAndIcons(FieldList $fields) { $logoTypes = array('jpg', 'jpeg', 'png', 'gif'); $iconTypes = array('ico'); $appleTouchTypes = array('png'); $fields->findOrMakeTab( 'Root.LogosIcons', _t(__CLASS__ . '.LogosIconsTab', 'Logos/Icons') ); $fields->addFieldToTab( 'Root.LogosIcons', $logoField = Injector::inst()->create( FileHandleField::class, 'Logo', _t(__CLASS__ . '.LogoUploadField', 'Logo, to appear in the top left') ) ); $logoField->getValidator()->setAllowedExtensions($logoTypes); $fields->addFieldToTab( 'Root.LogosIcons', $logoRetinaField = Injector::inst()->create( FileHandleField::class, 'LogoRetina', _t( 'CwpConfig.LogoRetinaUploadField', 'High resolution logo, to appear in the top left ' . '(recommended to be twice the height and width of the standard logo)' ) ) ); $logoRetinaField->getValidator()->setAllowedExtensions($logoTypes); $fields->addFieldToTab( 'Root.LogosIcons', $footerLogoField = Injector::inst()->create( FileHandleField::class, 'FooterLogo', _t(__CLASS__ . '.FooterLogoField', 'Footer logo, to appear in the footer') ) ); $footerLogoField->getValidator()->setAllowedExtensions($logoTypes); $fields->addFieldToTab( 'Root.LogosIcons', $footerLogoRetinaField = Injector::inst()->create( FileHandleField::class, 'FooterLogoRetina', _t( 'CwpConfig.FooterLogoRetinaField', 'High resolution footer logo (recommended twice the height and width of the standard footer logo)' ) ) ); $footerLogoRetinaField->getValidator()->setAllowedExtensions($logoTypes); $fields->addFieldToTab( 'Root.LogosIcons', $footerLink = TextField::create( 'FooterLogoLink', _t(__CLASS__ . '.FooterLogoLinkField', 'Footer Logo link') ) ); $footerLink->setRightTitle( _t( 'CwpConfig.FooterLogoLinkDesc', 'Please include the protocol (ie, http:// or https://) unless it is an internal link.' ) ); $fields->addFieldToTab( 'Root.LogosIcons', TextField::create( 'FooterLogoDescription', _t(__CLASS__ . '.FooterLogoDescField', 'Footer Logo description') ) ); $fields->addFieldToTab( 'Root.LogosIcons', $footerLogoSecondaryField = Injector::inst()->create( FileHandleField::class, 'FooterLogoSecondary', _t(__CLASS__ . '.FooterLogoSecondaryField', 'Secondary Footer Logo, to appear in the footer.') ) ); $footerLogoSecondaryField->getValidator()->setAllowedExtensions($logoTypes); $fields->addFieldToTab('Root.LogosIcons', $footerSecondaryLink = TextField::create( 'FooterLogoSecondaryLink', _t(__CLASS__ . '.FooterLogoSecondaryLinkField', 'Secondary Footer Logo link.') )); $footerSecondaryLink->setRightTitle(_t( 'CwpConfig.FooterLogoSecondaryLinkDesc', 'Please include the protocol (ie, http:// or https://) unless it is an internal link.' )); $fields->addFieldToTab('Root.LogosIcons', TextField::create( 'FooterLogoSecondaryDescription', _t(__CLASS__ . '.FooterLogoSecondaryDescField', 'Secondary Footer Logo description') )); $fields->addFieldToTab( 'Root.LogosIcons', $favIconField = Injector::inst()->create( FileHandleField::class, 'FavIcon', _t(__CLASS__ . '.FavIconField', 'Favicon, in .ico format, dimensions of 16x16, 32x32, or 48x48') ) ); $favIconField->getValidator()->setAllowedExtensions($iconTypes); $fields->addFieldToTab( 'Root.LogosIcons', $atIcon144 = Injector::inst()->create( FileHandleField::class, 'AppleTouchIcon144', _t( 'CwpConfig.AppleIconField144', 'Apple Touch Web Clip and Windows 8 Tile Icon (dimensions of 144x144, PNG format)' ) ) ); $atIcon144->getValidator()->setAllowedExtensions($appleTouchTypes); $fields->addFieldToTab( 'Root.LogosIcons', $atIcon114 = Injector::inst()->create( FileHandleField::class, 'AppleTouchIcon114', _t(__CLASS__ . '.AppleIconField114', 'Apple Touch Web Clip Icon (dimensions of 114x114, PNG format)') ) ); $atIcon114->getValidator()->setAllowedExtensions($appleTouchTypes); $fields->addFieldToTab( 'Root.LogosIcons', $atIcon72 = Injector::inst()->create( FileHandleField::class, 'AppleTouchIcon72', _t(__CLASS__ . '.AppleIconField72', 'Apple Touch Web Clip Icon (dimensions of 72x72, PNG format)') ) ); $atIcon72->getValidator()->setAllowedExtensions($appleTouchTypes); $fields->addFieldToTab( 'Root.LogosIcons', $atIcon57 = Injector::inst()->create( FileHandleField::class, 'AppleTouchIcon57', _t(__CLASS__ . '.AppleIconField57', 'Apple Touch Web Clip Icon (dimensions of 57x57, PNG format)') ) ); $atIcon57->getValidator()->setAllowedExtensions($appleTouchTypes); return $this; }
Add fields for logo and icon uploads @param FieldList $fields @return $this
entailment
protected function addSearchOptions(FieldList $fields) { $fields->findOrMakeTab('Root.SearchOptions'); $fields->addFieldToTab( 'Root.SearchOptions', TextField::create( 'EmptySearch', _t( 'CWP.SITECONFIG.EmptySearch', 'Text to display when there is no search query' ) ) ); $fields->addFieldToTab( 'Root.SearchOptions', TextField::create( 'NoSearchResults', _t( 'CWP.SITECONFIG.NoResult', 'Text to display when there are no results' ) ) ); return $this; }
Add user configurable search field labels @param FieldList $fields @return $this
entailment
protected function addThemeColorPicker(FieldList $fields) { // Only show theme colour selector if enabled if (!$this->owner->config()->get('enable_theme_color_picker')) { return $this; } $fonts = $this->owner->config()->get('theme_fonts'); // Import each font via the google fonts api to render font preview foreach ($fonts as $fontTitle) { $fontFamilyName = str_replace(' ', '+', $fontTitle); Requirements::css("//fonts.googleapis.com/css?family=$fontFamilyName"); } $fields->addFieldsToTab( 'Root.ThemeOptions', [ FontPickerField::create( 'MainFontFamily', _t( __CLASS__ . '.MainFontFamily', 'Main font family' ), $fonts ), ColorPickerField::create( 'HeaderBackground', _t( __CLASS__ . '.HeaderBackground', 'Header background' ), $this->getThemeOptionsExcluding([ 'default-accent', ]) ), ColorPickerField::create( 'NavigationBarBackground', _t( __CLASS__ . '.NavigationBarBackground', 'Navigation bar background' ), $this->getThemeOptionsExcluding([ 'default-accent', ]) ), ColorPickerField::create( 'CarouselBackground', _t( __CLASS__ . '.CarouselBackground', 'Carousel background' ), $this->getThemeOptionsExcluding([ 'default-accent', ]) )->setDescription( _t( __CLASS__ . '.CarouselBackgroundDescription', 'The background colour of the carousel when there is no image set.' ) ), ColorPickerField::create( 'FooterBackground', _t( __CLASS__ . '.FooterBackground', 'Footer background' ), $this->getThemeOptionsExcluding([ 'light-grey', 'white', 'default-accent', ]) ), ColorPickerField::create( 'AccentColor', _t( __CLASS__ . '.AccentColor', 'Accent colour' ), $this->getThemeOptionsExcluding([ 'light-grey', 'white', 'default-background', ]) )->setDescription( _t( __CLASS__ . '.AccentColorDescription', 'Affects colour of buttons, current navigation items, etc. '. 'Please ensure sufficient contrast with background colours.' ) ), ColorPickerField::create( 'TextLinkColor', _t( __CLASS__ . '.TextLinkColor', 'Text link colour' ), $this->getThemeOptionsExcluding([ 'black', 'light-grey', 'dark-grey', 'white', 'default-background', ]) ), ] ); return $this; }
Add fields for selecting the font theme colour for different areas of the site. @param FieldList $fields @return $this
entailment
public function getThemeOptionsExcluding($excludedColors = []) { $themeColors = $this->owner->config()->get('theme_colors'); $options = []; foreach ($themeColors as $themeColor) { if (in_array($themeColor['CSSClass'], $excludedColors)) { continue; } $options[] = $themeColor; } return $options; }
Returns theme_colors used for ColorPickerField. @param array $excludedColors list of colours to exclude from the returned options based on the theme colour's 'CSSClass' value @return array
entailment
public function onBeforeWrite() { $colorPickerEnabled = $this->owner->config()->get('enable_theme_color_picker'); if ($colorPickerEnabled && !$this->owner->HeaderBackground) { $this->owner->update([ 'MainFontFamily' => FontPickerField::DEFAULT_VALUE, 'HeaderBackground' => 'default-background', 'NavigationBarBackground' => 'default-background', 'CarouselBackground' => 'default-background', 'FooterBackground' => 'default-background', 'AccentColor' => 'default-accent', 'TextLinkColor' => 'default-accent', ]); } }
If HeaderBackground is not set, assume no theme colours exist and populate some defaults if the colour picker is enabled. We don't use populateDefaults() because we don't want SiteConfig to re-populate its own defaults.
entailment
public function addGridClasses($objElement, $strBuffer) { // Init $strClasses = ""; // Bei diesen ContentElementen soll nichts verändert werden $arrWrongCE = array('rowStart', 'rowEnd', 'colEnd'); // Abfrage, ob anzupassenden CEs und Klassen gesetzt wurden if (!in_array($objElement->type, $arrWrongCE) && (isset($objElement->grid_columns) || isset($objElement->grid_options))) { // Columns Klassen auslesen und in String speichern if($objElement->grid_columns) { $env = "FE"; $strField = "grid_columns"; $arrGridClasses = unserialize($objElement->grid_columns); foreach ($arrGridClasses as $class) { // HOOK: create and manipulate grid classes if (isset($GLOBALS['TL_HOOKS']['manipulateGridClasses']) && is_array($GLOBALS['TL_HOOKS']['manipulateGridClasses'])) { foreach ($GLOBALS['TL_HOOKS']['manipulateGridClasses'] as $callback) { $this->import($callback[0]); $class = $this->{$callback[0]}->{$callback[1]}($env, $strField, $class); } } $strClasses .= $class." "; } } // Weitere Optionen Klassen auslesen und in String speichern if($objElement->grid_options) { $env = "FE"; $strField = "grid_options"; $arrGridClasses = unserialize($objElement->grid_options); foreach ($arrGridClasses as $class) { // HOOK: create and manipulate grid classes if (isset($GLOBALS['TL_HOOKS']['manipulateGridClasses']) && is_array($GLOBALS['TL_HOOKS']['manipulateGridClasses'])) { foreach ($GLOBALS['TL_HOOKS']['manipulateGridClasses'] as $callback) { $this->import($callback[0]); $class = $this->{$callback[0]}->{$callback[1]}($env, $strField, $class); } } $strClasses .= $class." "; } } // Ausgabe abhängig vom Elementtyp anpassen switch ($objElement->type) { case 'rowStart': case 'rowEnd': case 'colEnd': # code... break; case 'colStart': // vorhandene Klasse erweitern $strBuffer = str_replace('ce_colStart', 'ce_colStart '.$strClasses, $strBuffer); break; default: // Umschließendes DIV hinzufügen $strBuffer = '<div class="' . $strClasses . '">' . $strBuffer . '</div>'; break; } } // Rückgabe return $strBuffer; }
Grid-Klassen dem CE hinzufügen
entailment
public function addGridClassesToForms($objWidget, $strForm, $arrForm) { // Init $strClasses = ""; // Bei diesen ContentElementen soll nichts verändert werden $arrWrongFields = array('rowStart', 'rowEnd', 'colEnd', 'html', 'fieldsetfsStop'); // Abfrage, ob anzupassenden CEs und Klassen gesetzt wurden if (!in_array($objWidget->type, $arrWrongFields) && (isset($objWidget->grid_columns) || isset($objWidget->grid_options))) { if($objWidget->grid_columns) { $env = "FE"; $strField = "grid_columns"; $arrGridClasses = unserialize($objWidget->grid_columns); foreach ($arrGridClasses as $class) { // HOOK: create and manipulate grid classes if (isset($GLOBALS['TL_HOOKS']['manipulateGridClasses']) && is_array($GLOBALS['TL_HOOKS']['manipulateGridClasses'])) { foreach ($GLOBALS['TL_HOOKS']['manipulateGridClasses'] as $callback) { $this->import($callback[0]); $class = $this->{$callback[0]}->{$callback[1]}($env, $strField, $class); } } $strClasses .= $class." "; } } // Weitere Optionen Klassen auslesen und in String speichern if($objWidget->grid_options) { $env = "FE"; $strField = "grid_options"; $arrGridClasses = unserialize($objWidget->grid_options); foreach ($arrGridClasses as $class) { // HOOK: create and manipulate grid classes if (isset($GLOBALS['TL_HOOKS']['manipulateGridClasses']) && is_array($GLOBALS['TL_HOOKS']['manipulateGridClasses'])) { foreach ($GLOBALS['TL_HOOKS']['manipulateGridClasses'] as $callback) { $this->import($callback[0]); $class = $this->{$callback[0]}->{$callback[1]}($env, $strField, $class); } } $strClasses .= $class." "; } } // Klassen anfügen if ($objWidget->type === 'fieldset' || $objWidget->type==='submit') { $objWidget->class = $strClasses; } else { $objWidget->prefix .= " ".$strClasses; } } return $objWidget; }
Grid-Klassen dem CE hinzufügen
entailment
public function __isset($property) { switch ($property) { case 'mainLocation': case 'content': return true; } if (property_exists($this, $property) || property_exists($this->innerContentInfo, $property)) { return true; } return parent::__isset($property); }
Magic isset for signaling existence of convenience properties. @param string $property @return bool
entailment
protected function extractValueObjects(SearchResult $searchResult) { return array_map( function (SearchHit $searchHit) { return $searchHit->valueObject; }, $searchResult->searchHits ); }
Extracts value objects from SearchResult. @param \eZ\Publish\API\Repository\Values\Content\Search\SearchResult $searchResult @return \eZ\Publish\API\Repository\Values\ValueObject[]
entailment
public function get_groups() { $groups = array( array( 'id' => 'actions', 'name' => __( 'Actions', 'icon-picker' ), ), array( 'id' => 'currency', 'name' => __( 'Currency', 'icon-picker' ), ), array( 'id' => 'media', 'name' => __( 'Media', 'icon-picker' ), ), array( 'id' => 'misc', 'name' => __( 'Misc.', 'icon-picker' ), ), array( 'id' => 'places', 'name' => __( 'Places', 'icon-picker' ), ), array( 'id' => 'social', 'name' => __( 'Social', 'icon-picker' ), ), ); /** * Filter genericon groups * * @since 0.1.0 * @param array $groups Icon groups. */ $groups = apply_filters( 'icon_picker_genericon_groups', $groups ); return $groups; }
Get icon groups @since 0.1.0 @return array
entailment
public function get_items() { $items = array( array( 'group' => 'actions', 'id' => 'el-icon-adjust', 'name' => __( 'Adjust', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-adjust-alt', 'name' => __( 'Adjust', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-align-left', 'name' => __( 'Align Left', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-align-center', 'name' => __( 'Align Center', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-align-right', 'name' => __( 'Align Right', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-align-justify', 'name' => __( 'Justify', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-arrow-up', 'name' => __( 'Arrow Up', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-arrow-down', 'name' => __( 'Arrow Down', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-arrow-left', 'name' => __( 'Arrow Left', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-arrow-right', 'name' => __( 'Arrow Right', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-fast-backward', 'name' => __( 'Fast Backward', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-step-backward', 'name' => __( 'Step Backward', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-backward', 'name' => __( 'Backward', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-forward', 'name' => __( 'Forward', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-forward-alt', 'name' => __( 'Forward', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-step-forward', 'name' => __( 'Step Forward', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-fast-forward', 'name' => __( 'Fast Forward', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-bold', 'name' => __( 'Bold', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-italic', 'name' => __( 'Italic', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-link', 'name' => __( 'Link', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-caret-up', 'name' => __( 'Caret Up', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-caret-down', 'name' => __( 'Caret Down', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-caret-left', 'name' => __( 'Caret Left', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-caret-right', 'name' => __( 'Caret Right', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-check', 'name' => __( 'Check', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-check-empty', 'name' => __( 'Check Empty', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-chevron-up', 'name' => __( 'Chevron Up', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-chevron-down', 'name' => __( 'Chevron Down', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-chevron-left', 'name' => __( 'Chevron Left', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-chevron-right', 'name' => __( 'Chevron Right', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-circle-arrow-up', 'name' => __( 'Circle Arrow Up', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-circle-arrow-down', 'name' => __( 'Circle Arrow Down', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-circle-arrow-left', 'name' => __( 'Circle Arrow Left', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-circle-arrow-right', 'name' => __( 'Circle Arrow Right', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-download', 'name' => __( 'Download', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-download-alt', 'name' => __( 'Download', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-edit', 'name' => __( 'Edit', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-eject', 'name' => __( 'Eject', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-file-new', 'name' => __( 'File New', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-file-new-alt', 'name' => __( 'File New', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-file-edit', 'name' => __( 'File Edit', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-file-edit-alt', 'name' => __( 'File Edit', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-fork', 'name' => __( 'Fork', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-fullscreen', 'name' => __( 'Fullscreen', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-indent-left', 'name' => __( 'Indent Left', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-indent-right', 'name' => __( 'Indent Right', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-list', 'name' => __( 'List', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-list-alt', 'name' => __( 'List', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-lock', 'name' => __( 'Lock', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-lock-alt', 'name' => __( 'Lock', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-unlock', 'name' => __( 'Unlock', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-unlock-alt', 'name' => __( 'Unlock', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-map-marker', 'name' => __( 'Map Marker', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-map-marker-alt', 'name' => __( 'Map Marker', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-minus', 'name' => __( 'Minus', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-minus-sign', 'name' => __( 'Minus Sign', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-move', 'name' => __( 'Move', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-off', 'name' => __( 'Off', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-ok', 'name' => __( 'OK', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-ok-circle', 'name' => __( 'OK Circle', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-ok-sign', 'name' => __( 'OK Sign', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-play', 'name' => __( 'Play', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-play-alt', 'name' => __( 'Play', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-pause', 'name' => __( 'Pause', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-pause-alt', 'name' => __( 'Pause', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-stop', 'name' => __( 'Stop', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-stop-alt', 'name' => __( 'Stop', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-plus', 'name' => __( 'Plus', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-plus-sign', 'name' => __( 'Plus Sign', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-print', 'name' => __( 'Print', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-question', 'name' => __( 'Question', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-question-sign', 'name' => __( 'Question Sign', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-record', 'name' => __( 'Record', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-refresh', 'name' => __( 'Refresh', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-remove', 'name' => __( 'Remove', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-repeat', 'name' => __( 'Repeat', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-repeat-alt', 'name' => __( 'Repeat', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-resize-vertical', 'name' => __( 'Resize Vertical', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-resize-horizontal', 'name' => __( 'Resize Horizontal', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-resize-full', 'name' => __( 'Resize Full', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-resize-small', 'name' => __( 'Resize Small', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-return-key', 'name' => __( 'Return', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-retweet', 'name' => __( 'Retweet', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-reverse-alt', 'name' => __( 'Reverse', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-search', 'name' => __( 'Search', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-search-alt', 'name' => __( 'Search', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-share', 'name' => __( 'Share', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-share-alt', 'name' => __( 'Share', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-tag', 'name' => __( 'Tag', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-tasks', 'name' => __( 'Tasks', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-text-height', 'name' => __( 'Text Height', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-text-width', 'name' => __( 'Text Width', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-thumbs-up', 'name' => __( 'Thumbs Up', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-thumbs-down', 'name' => __( 'Thumbs Down', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-tint', 'name' => __( 'Tint', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-trash', 'name' => __( 'Trash', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-trash-alt', 'name' => __( 'Trash', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-upload', 'name' => __( 'Upload', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-view-mode', 'name' => __( 'View Mode', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-volume-up', 'name' => __( 'Volume Up', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-volume-down', 'name' => __( 'Volume Down', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-volume-off', 'name' => __( 'Mute', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-warning-sign', 'name' => __( 'Warning Sign', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-zoom-in', 'name' => __( 'Zoom In', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'el-icon-zoom-out', 'name' => __( 'Zoom Out', 'icon-picker' ), ), array( 'group' => 'currency', 'id' => 'el-icon-eur', 'name' => 'EUR', ), array( 'group' => 'currency', 'id' => 'el-icon-gbp', 'name' => 'GBP', ), array( 'group' => 'currency', 'id' => 'el-icon-usd', 'name' => 'USD', ), array( 'group' => 'media', 'id' => 'el-icon-video', 'name' => __( 'Video', 'icon-picker' ), ), array( 'group' => 'media', 'id' => 'el-icon-video-alt', 'name' => __( 'Video', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-adult', 'name' => __( 'Adult', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-address-book', 'name' => __( 'Address Book', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-address-book-alt', 'name' => __( 'Address Book', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-asl', 'name' => __( 'ASL', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-asterisk', 'name' => __( 'Asterisk', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-ban-circle', 'name' => __( 'Ban Circle', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-barcode', 'name' => __( 'Barcode', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-bell', 'name' => __( 'Bell', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-blind', 'name' => __( 'Blind', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-book', 'name' => __( 'Book', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-braille', 'name' => __( 'Braille', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-briefcase', 'name' => __( 'Briefcase', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-broom', 'name' => __( 'Broom', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-brush', 'name' => __( 'Brush', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-bulb', 'name' => __( 'Bulb', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-bullhorn', 'name' => __( 'Bullhorn', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-calendar', 'name' => __( 'Calendar', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-calendar-sign', 'name' => __( 'Calendar Sign', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-camera', 'name' => __( 'Camera', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-car', 'name' => __( 'Car', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-cc', 'name' => __( 'CC', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-certificate', 'name' => __( 'Certificate', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-child', 'name' => __( 'Child', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-cog', 'name' => __( 'Cog', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-cog-alt', 'name' => __( 'Cog', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-cogs', 'name' => __( 'Cogs', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-comment', 'name' => __( 'Comment', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-comment-alt', 'name' => __( 'Comment', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-compass', 'name' => __( 'Compass', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-compass-alt', 'name' => __( 'Compass', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-credit-card', 'name' => __( 'Credit Card', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-css', 'name' => 'CSS', ), array( 'group' => 'misc', 'id' => 'el-icon-envelope', 'name' => __( 'Envelope', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-envelope-alt', 'name' => __( 'Envelope', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-error', 'name' => __( 'Error', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-error-alt', 'name' => __( 'Error', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-exclamation-sign', 'name' => __( 'Exclamation Sign', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-eye-close', 'name' => __( 'Eye Close', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-eye-open', 'name' => __( 'Eye Open', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-male', 'name' => __( 'Male', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-female', 'name' => __( 'Female', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-file', 'name' => __( 'File', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-file-alt', 'name' => __( 'File', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-film', 'name' => __( 'Film', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-filter', 'name' => __( 'Filter', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-fire', 'name' => __( 'Fire', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-flag', 'name' => __( 'Flag', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-flag-alt', 'name' => __( 'Flag', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-folder', 'name' => __( 'Folder', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-folder-open', 'name' => __( 'Folder Open', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-folder-close', 'name' => __( 'Folder Close', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-folder-sign', 'name' => __( 'Folder Sign', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-font', 'name' => __( 'Font', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-fontsize', 'name' => __( 'Font Size', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-gift', 'name' => __( 'Gift', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-glass', 'name' => __( 'Glass', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-glasses', 'name' => __( 'Glasses', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-globe', 'name' => __( 'Globe', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-globe-alt', 'name' => __( 'Globe', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-graph', 'name' => __( 'Graph', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-graph-alt', 'name' => __( 'Graph', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-group', 'name' => __( 'Group', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-group-alt', 'name' => __( 'Group', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-guidedog', 'name' => __( 'Guide Dog', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-hand-up', 'name' => __( 'Hand Up', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-hand-down', 'name' => __( 'Hand Down', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-hand-left', 'name' => __( 'Hand Left', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-hand-right', 'name' => __( 'Hand Right', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-hdd', 'name' => __( 'HDD', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-headphones', 'name' => __( 'Headphones', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-hearing-impaired', 'name' => __( 'Hearing Impaired', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-heart', 'name' => __( 'Heart', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-heart-alt', 'name' => __( 'Heart', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-heart-empty', 'name' => __( 'Heart Empty', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-hourglass', 'name' => __( 'Hourglass', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-idea', 'name' => __( 'Idea', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-idea-alt', 'name' => __( 'Idea', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-inbox', 'name' => __( 'Inbox', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-inbox-alt', 'name' => __( 'Inbox', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-inbox-box', 'name' => __( 'Inbox', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-info-sign', 'name' => __( 'Info', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-key', 'name' => __( 'Key', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-laptop', 'name' => __( 'Laptop', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-laptop-alt', 'name' => __( 'Laptop', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-leaf', 'name' => __( 'Leaf', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-lines', 'name' => __( 'Lines', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-magic', 'name' => __( 'Magic', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-magnet', 'name' => __( 'Magnet', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-mic', 'name' => __( 'Mic', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-music', 'name' => __( 'Music', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-paper-clip', 'name' => __( 'Paper Clip', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-paper-clip-alt', 'name' => __( 'Paper Clip', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-pencil', 'name' => __( 'Pencil', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-pencil-alt', 'name' => __( 'Pencil', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-person', 'name' => __( 'Person', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-phone', 'name' => __( 'Phone', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-phone-alt', 'name' => __( 'Phone', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-photo', 'name' => __( 'Photo', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-photo-alt', 'name' => __( 'Photo', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-picture', 'name' => __( 'Picture', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-plane', 'name' => __( 'Plane', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-podcast', 'name' => __( 'Podcast', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-puzzle', 'name' => __( 'Puzzle', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-qrcode', 'name' => __( 'QR Code', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-quotes', 'name' => __( 'Quotes', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-quotes-alt', 'name' => __( 'Quotes', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-random', 'name' => __( 'Random', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-scissors', 'name' => __( 'Scissors', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-screen', 'name' => __( 'Screen', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-screen-alt', 'name' => __( 'Screen', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-screenshot', 'name' => __( 'Screenshot', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-shopping-cart', 'name' => __( 'Shopping Cart', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-shopping-cart-sign', 'name' => __( 'Shopping Cart Sign', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-signal', 'name' => __( 'Signal', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-smiley', 'name' => __( 'Smiley', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-smiley-alt', 'name' => __( 'Smiley', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-speaker', 'name' => __( 'Speaker', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-user', 'name' => __( 'User', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-th', 'name' => __( 'Thumbnails', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-th-large', 'name' => __( 'Thumbnails (Large)', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-th-list', 'name' => __( 'Thumbnails (List)', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-time', 'name' => __( 'Time', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-time-alt', 'name' => __( 'Time', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-torso', 'name' => __( 'Torso', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-wheelchair', 'name' => __( 'Wheelchair', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-wrench', 'name' => __( 'Wrench', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-wrench-alt', 'name' => __( 'Wrench', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'el-icon-universal-access', 'name' => __( 'Universal Access', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-bookmark', 'name' => __( 'Bookmark', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-bookmark-empty', 'name' => __( 'Bookmark Empty', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-dashboard', 'name' => __( 'Dashboard', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-home', 'name' => __( 'Home', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-home-alt', 'name' => __( 'Home', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-iphone-home', 'name' => __( 'Home (iPhone)', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-network', 'name' => __( 'Network', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-tags', 'name' => __( 'Tags', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-website', 'name' => __( 'Website', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'el-icon-website-alt', 'name' => __( 'Website', 'icon-picker' ), ), array( 'group' => 'social', 'id' => 'el-icon-behance', 'name' => 'Behance', ), array( 'group' => 'social', 'id' => 'el-icon-blogger', 'name' => 'Blogger', ), array( 'group' => 'social', 'id' => 'el-icon-cloud', 'name' => __( 'Cloud', 'icon-picker' ), ), array( 'group' => 'social', 'id' => 'el-icon-cloud-alt', 'name' => __( 'Cloud', 'icon-picker' ), ), array( 'group' => 'social', 'id' => 'el-icon-delicious', 'name' => 'Delicious', ), array( 'group' => 'social', 'id' => 'el-icon-deviantart', 'name' => 'DeviantArt', ), array( 'group' => 'social', 'id' => 'el-icon-digg', 'name' => 'Digg', ), array( 'group' => 'social', 'id' => 'el-icon-dribbble', 'name' => 'Dribbble', ), array( 'group' => 'social', 'id' => 'el-icon-facebook', 'name' => 'Facebook', ), array( 'group' => 'social', 'id' => 'el-icon-facetime-video', 'name' => 'Facetime Video', ), array( 'group' => 'social', 'id' => 'el-icon-flickr', 'name' => 'Flickr', ), array( 'group' => 'social', 'id' => 'el-icon-foursquare', 'name' => 'Foursquare', ), array( 'group' => 'social', 'id' => 'el-icon-friendfeed', 'name' => 'FriendFeed', ), array( 'group' => 'social', 'id' => 'el-icon-friendfeed-rect', 'name' => 'FriendFeed', ), array( 'group' => 'social', 'id' => 'el-icon-github', 'name' => 'GitHub', ), array( 'group' => 'social', 'id' => 'el-icon-github-text', 'name' => 'GitHub', ), array( 'group' => 'social', 'id' => 'el-icon-googleplus', 'name' => 'Google+', ), array( 'group' => 'social', 'id' => 'el-icon-instagram', 'name' => 'Instagram', ), array( 'group' => 'social', 'id' => 'el-icon-lastfm', 'name' => 'Last.fm', ), array( 'group' => 'social', 'id' => 'el-icon-linkedin', 'name' => 'LinkedIn', ), array( 'group' => 'social', 'id' => 'el-icon-livejournal', 'name' => 'LiveJournal', ), array( 'group' => 'social', 'id' => 'el-icon-myspace', 'name' => 'MySpace', ), array( 'group' => 'social', 'id' => 'el-icon-opensource', 'name' => __( 'Open Source', 'icon-picker' ), ), array( 'group' => 'social', 'id' => 'el-icon-path', 'name' => 'path', ), array( 'group' => 'social', 'id' => 'el-icon-picasa', 'name' => 'Picasa', ), array( 'group' => 'social', 'id' => 'el-icon-pinterest', 'name' => 'Pinterest', ), array( 'group' => 'social', 'id' => 'el-icon-rss', 'name' => 'RSS', ), array( 'group' => 'social', 'id' => 'el-icon-reddit', 'name' => 'Reddit', ), array( 'group' => 'social', 'id' => 'el-icon-skype', 'name' => 'Skype', ), array( 'group' => 'social', 'id' => 'el-icon-slideshare', 'name' => 'Slideshare', ), array( 'group' => 'social', 'id' => 'el-icon-soundcloud', 'name' => 'SoundCloud', ), array( 'group' => 'social', 'id' => 'el-icon-spotify', 'name' => 'Spotify', ), array( 'group' => 'social', 'id' => 'el-icon-stackoverflow', 'name' => 'Stack Overflow', ), array( 'group' => 'social', 'id' => 'el-icon-stumbleupon', 'name' => 'StumbleUpon', ), array( 'group' => 'social', 'id' => 'el-icon-twitter', 'name' => 'Twitter', ), array( 'group' => 'social', 'id' => 'el-icon-tumblr', 'name' => 'Tumblr', ), array( 'group' => 'social', 'id' => 'el-icon-viadeo', 'name' => 'Viadeo', ), array( 'group' => 'social', 'id' => 'el-icon-vimeo', 'name' => 'Vimeo', ), array( 'group' => 'social', 'id' => 'el-icon-vkontakte', 'name' => 'VKontakte', ), array( 'group' => 'social', 'id' => 'el-icon-w3c', 'name' => 'W3C', ), array( 'group' => 'social', 'id' => 'el-icon-wordpress', 'name' => 'WordPress', ), array( 'group' => 'social', 'id' => 'el-icon-youtube', 'name' => 'YouTube', ), ); /** * Filter genericon items * * @since 0.1.0 * @param array $items Icon names. */ $items = apply_filters( 'icon_picker_genericon_items', $items ); return $items; }
Get icon names @since 0.1.0 @return array
entailment
public static function exec($url, array $req = []) { usleep(120000); // generate the POST data string $postData = http_build_query($req, '', '&'); // curl handle (initialize if required) if (is_null(self::$ch)) { self::$ch = curl_init(); curl_setopt(self::$ch, CURLOPT_RETURNTRANSFER, true); curl_setopt( self::$ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; CoinMarketCap PHP API; ' . php_uname('a') . '; PHP/' . phpversion() . ')' ); } curl_setopt(self::$ch, CURLOPT_URL, $url . "?" . $postData); curl_setopt(self::$ch, CURLOPT_SSL_VERIFYPEER, false); // run the query $res = curl_exec(self::$ch); if ($res === false) { throw new \Exception("Curl error: " . curl_error(self::$ch)); } $json = json_decode($res, true); // Check for the CoinMarketCap API error if (isset($json['error'])) { throw new \Exception("CoinMarketCap API error: {$json['error']}"); } return $json; }
Executes curl request to the CoinMarketCap API. @param array $req Request parameters list. @return array JSON data. @throws \Exception If Curl error or CoinMarketCap API error occurred.
entailment
public static function json($url) { $opts = [ 'http' => [ 'method' => 'GET', 'timeout' => 10 ] ]; $context = stream_context_create($opts); $feed = file_get_contents($url, false, $context); $json = json_decode($feed, true); return $json; }
Executes simple GET request to the CoinMarketCap public API. @param string $url API method URL. @return array JSON data.
entailment
public function mapContent(VersionInfo $versionInfo, $languageCode) { $contentInfo = $versionInfo->contentInfo; return new Content( [ 'id' => $contentInfo->id, 'mainLocationId' => $contentInfo->mainLocationId, 'name' => $versionInfo->getName($languageCode), 'languageCode' => $languageCode, 'innerVersionInfo' => $versionInfo, 'site' => $this->site, 'domainObjectMapper' => $this, 'repository' => $this->repository, ] ); }
Maps Repository Content to the Site Content. @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo @param string $languageCode @return \Netgen\EzPlatformSiteApi\Core\Site\Values\Content
entailment
public function mapContentInfo(VersionInfo $versionInfo, $languageCode) { $contentInfo = $versionInfo->contentInfo; $contentType = $this->contentTypeService->loadContentType($contentInfo->contentTypeId); return new ContentInfo( [ 'name' => $versionInfo->getName($languageCode), 'languageCode' => $languageCode, 'contentTypeIdentifier' => $contentType->identifier, 'contentTypeName' => $this->getTranslatedString($languageCode, (array)$contentType->getNames()), 'contentTypeDescription' => $this->getTranslatedString($languageCode, (array)$contentType->getDescriptions()), 'innerContentInfo' => $versionInfo->contentInfo, 'innerContentType' => $contentType, 'site' => $this->site, ] ); }
Maps Repository ContentInfo to the Site ContentInfo. @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo @param string $languageCode @return \Netgen\EzPlatformSiteApi\API\Values\ContentInfo
entailment
public function mapLocation(APILocation $location, VersionInfo $versionInfo, $languageCode) { return new Location( [ 'innerLocation' => $location, 'languageCode' => $languageCode, 'innerVersionInfo' => $versionInfo, 'site' => $this->site, 'domainObjectMapper' => $this, ] ); }
Maps Repository Location to the Site Location. @param \eZ\Publish\API\Repository\Values\Content\Location $location @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo @param string $languageCode @return \Netgen\EzPlatformSiteApi\API\Values\Location
entailment
public function mapNode(APILocation $location, APIContent $content, $languageCode) { return new Node( [ 'contentInfo' => $this->mapContentInfo($content->versionInfo, $languageCode), 'innerLocation' => $location, 'content' => $this->mapContent($content->versionInfo, $languageCode), 'site' => $this->site, ] ); }
Maps Repository Content and Location to the Site Node. @param \eZ\Publish\API\Repository\Values\Content\Location $location @param \eZ\Publish\API\Repository\Values\Content\Content $content @param string $languageCode @return \Netgen\EzPlatformSiteApi\Core\Site\Values\Node
entailment
public function mapField(APIField $apiField, SiteContent $content) { $fieldDefinition = $content->contentInfo->innerContentType->getFieldDefinition($apiField->fieldDefIdentifier); $fieldTypeIdentifier = $fieldDefinition->fieldTypeIdentifier; $isEmpty = $this->fieldTypeService->getFieldType($fieldTypeIdentifier)->isEmptyValue( $apiField->value ); return new Field([ 'id' => $apiField->id, 'fieldDefIdentifier' => $fieldDefinition->identifier, 'value' => $apiField->value, 'languageCode' => $apiField->languageCode, 'fieldTypeIdentifier' => $fieldTypeIdentifier, 'name' => $this->getTranslatedString( $content->languageCode, (array)$fieldDefinition->getNames() ), 'description' => $this->getTranslatedString( $content->languageCode, (array)$fieldDefinition->getDescriptions() ), 'content' => $content, 'innerField' => $apiField, 'innerFieldDefinition' => $fieldDefinition, 'isEmpty' => $isEmpty, ]); }
Maps Repository Field to the Site Field. @param \eZ\Publish\API\Repository\Values\Content\Field $apiField @param \Netgen\EzPlatformSiteApi\API\Values\Content $content @return \Netgen\EzPlatformSiteApi\API\Values\Field
entailment
protected function getFilterCriteria(array $parameters) { /** @var \Netgen\EzPlatformSiteApi\API\Values\Location $location */ $location = $parameters['location']; return [ new ParentLocationId($location->parentLocationId), new LogicalNot(new LocationId($location->id)), ]; }
{@inheritdoc} @throws \InvalidArgumentException
entailment
protected function configureOptions(OptionsResolver $resolver) { $resolver->remove(['parent_location_id', 'subtree']); $resolver->setRequired(['location']); $resolver->setDefined([ 'exclude_self', 'relative_depth', ]); $resolver->setAllowedTypes('location', [SiteLocation::class]); $resolver->setAllowedTypes('exclude_self', ['bool']); $resolver->setAllowedTypes('relative_depth', ['int', 'array']); $resolver->setDefaults([ 'exclude_self' => true, ]); }
{@inheritdoc} @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException @throws \Symfony\Component\OptionsResolver\Exception\AccessException
entailment
protected function getFilterCriteria(array $parameters) { /** @var \Netgen\EzPlatformSiteApi\API\Values\Location $location */ $location = $parameters['location']; $criteria = []; $criteria[] = new SubtreeCriterion($location->pathString); if ($parameters['exclude_self']) { $criteria[] = new LogicalNot(new LocationId($location->id)); } return $criteria; }
{@inheritdoc} @throws \InvalidArgumentException
entailment
public function getNbResults() { if (isset($this->nbResults)) { return $this->nbResults; } return $this->nbResults = $this->getSearchResultWithLimitZero()->totalCount; }
Returns the number of results. @return int The number of results
entailment
public function getFacets() { if (isset($this->facets)) { return $this->facets; } return $this->facets = $this->getSearchResultWithLimitZero()->facets; }
Returns the facets of the results. @return \eZ\Publish\API\Repository\Values\Content\Search\Facet[] The facets of the results
entailment
public function getSlice($offset, $length) { $query = clone $this->query; $query->offset = $offset; $query->limit = $length; $query->performCount = false; $searchResult = $this->filterService->filterLocations($query); // Set count for further use if returned by search engine despite !performCount (Solr, ES) if (!isset($this->nbResults) && isset($searchResult->totalCount)) { $this->nbResults = $searchResult->totalCount; } if (!isset($this->facets) && isset($searchResult->facets)) { $this->facets = $searchResult->facets; } $list = []; foreach ($searchResult->searchHits as $hit) { $list[] = $hit->valueObject; } return $list; }
Returns a slice of the results, as Site Location objects. @param int $offset The offset @param int $length The length @return \Netgen\EzPlatformSiteApi\API\Values\Location[]
entailment
public function get_items() { $items = array( array( 'group' => 'actions', 'id' => 'genericon-checkmark', 'name' => __( 'Checkmark', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-close', 'name' => __( 'Close', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-close-alt', 'name' => __( 'Close', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-dropdown', 'name' => __( 'Dropdown', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-dropdown-left', 'name' => __( 'Dropdown left', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-collapse', 'name' => __( 'Collapse', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-expand', 'name' => __( 'Expand', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-help', 'name' => __( 'Help', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-info', 'name' => __( 'Info', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-lock', 'name' => __( 'Lock', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-maximize', 'name' => __( 'Maximize', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-minimize', 'name' => __( 'Minimize', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-plus', 'name' => __( 'Plus', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-minus', 'name' => __( 'Minus', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-previous', 'name' => __( 'Previous', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-next', 'name' => __( 'Next', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-move', 'name' => __( 'Move', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-hide', 'name' => __( 'Hide', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-show', 'name' => __( 'Show', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-print', 'name' => __( 'Print', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-rating-empty', 'name' => __( 'Rating: Empty', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-rating-half', 'name' => __( 'Rating: Half', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-rating-full', 'name' => __( 'Rating: Full', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-refresh', 'name' => __( 'Refresh', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-reply', 'name' => __( 'Reply', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-reply-alt', 'name' => __( 'Reply alt', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-reply-single', 'name' => __( 'Reply single', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-search', 'name' => __( 'Search', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-send-to-phone', 'name' => __( 'Send to', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-send-to-tablet', 'name' => __( 'Send to', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-share', 'name' => __( 'Share', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-shuffle', 'name' => __( 'Shuffle', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-spam', 'name' => __( 'Spam', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-subscribe', 'name' => __( 'Subscribe', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-subscribed', 'name' => __( 'Subscribed', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-unsubscribe', 'name' => __( 'Unsubscribe', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-top', 'name' => __( 'Top', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-unapprove', 'name' => __( 'Unapprove', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-zoom', 'name' => __( 'Zoom', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-unzoom', 'name' => __( 'Unzoom', 'icon-picker' ), ), array( 'group' => 'actions', 'id' => 'genericon-xpost', 'name' => __( 'X-Post', 'icon-picker' ), ), array( 'group' => 'media-player', 'id' => 'genericon-skip-back', 'name' => __( 'Skip back', 'icon-picker' ), ), array( 'group' => 'media-player', 'id' => 'genericon-rewind', 'name' => __( 'Rewind', 'icon-picker' ), ), array( 'group' => 'media-player', 'id' => 'genericon-play', 'name' => __( 'Play', 'icon-picker' ), ), array( 'group' => 'media-player', 'id' => 'genericon-pause', 'name' => __( 'Pause', 'icon-picker' ), ), array( 'group' => 'media-player', 'id' => 'genericon-stop', 'name' => __( 'Stop', 'icon-picker' ), ), array( 'group' => 'media-player', 'id' => 'genericon-fastforward', 'name' => __( 'Fast Forward', 'icon-picker' ), ), array( 'group' => 'media-player', 'id' => 'genericon-skip-ahead', 'name' => __( 'Skip ahead', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-comment', 'name' => __( 'Comment', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-category', 'name' => __( 'Category', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-hierarchy', 'name' => __( 'Hierarchy', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-tag', 'name' => __( 'Tag', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-time', 'name' => __( 'Time', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-user', 'name' => __( 'User', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-day', 'name' => __( 'Day', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-week', 'name' => __( 'Week', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-month', 'name' => __( 'Month', 'icon-picker' ), ), array( 'group' => 'meta', 'id' => 'genericon-pinned', 'name' => __( 'Pinned', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-uparrow', 'name' => __( 'Arrow Up', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-downarrow', 'name' => __( 'Arrow Down', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-leftarrow', 'name' => __( 'Arrow Left', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-rightarrow', 'name' => __( 'Arrow Right', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-activity', 'name' => __( 'Activity', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-bug', 'name' => __( 'Bug', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-book', 'name' => __( 'Book', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-cart', 'name' => __( 'Cart', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-cloud-download', 'name' => __( 'Cloud Download', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-cloud-upload', 'name' => __( 'Cloud Upload', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-cog', 'name' => __( 'Cog', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-document', 'name' => __( 'Document', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-dot', 'name' => __( 'Dot', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-download', 'name' => __( 'Download', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-draggable', 'name' => __( 'Draggable', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-ellipsis', 'name' => __( 'Ellipsis', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-external', 'name' => __( 'External', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-feed', 'name' => __( 'Feed', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-flag', 'name' => __( 'Flag', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-fullscreen', 'name' => __( 'Fullscreen', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-handset', 'name' => __( 'Handset', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-heart', 'name' => __( 'Heart', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-key', 'name' => __( 'Key', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-mail', 'name' => __( 'Mail', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-menu', 'name' => __( 'Menu', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-microphone', 'name' => __( 'Microphone', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-notice', 'name' => __( 'Notice', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-paintbrush', 'name' => __( 'Paint Brush', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-phone', 'name' => __( 'Phone', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-picture', 'name' => __( 'Picture', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-plugin', 'name' => __( 'Plugin', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-portfolio', 'name' => __( 'Portfolio', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-star', 'name' => __( 'Star', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-summary', 'name' => __( 'Summary', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-tablet', 'name' => __( 'Tablet', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-videocamera', 'name' => __( 'Video Camera', 'icon-picker' ), ), array( 'group' => 'misc', 'id' => 'genericon-warning', 'name' => __( 'Warning', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'genericon-404', 'name' => __( '404', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'genericon-trash', 'name' => __( 'Trash', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'genericon-cloud', 'name' => __( 'Cloud', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'genericon-home', 'name' => __( 'Home', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'genericon-location', 'name' => __( 'Location', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'genericon-sitemap', 'name' => __( 'Sitemap', 'icon-picker' ), ), array( 'group' => 'places', 'id' => 'genericon-website', 'name' => __( 'Website', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-standard', 'name' => __( 'Standard', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-aside', 'name' => __( 'Aside', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-image', 'name' => __( 'Image', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-gallery', 'name' => __( 'Gallery', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-video', 'name' => __( 'Video', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-status', 'name' => __( 'Status', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-quote', 'name' => __( 'Quote', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-link', 'name' => __( 'Link', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-chat', 'name' => __( 'Chat', 'icon-picker' ), ), array( 'group' => 'post-formats', 'id' => 'genericon-audio', 'name' => __( 'Audio', 'icon-picker' ), ), array( 'group' => 'text-editor', 'id' => 'genericon-anchor', 'name' => __( 'Anchor', 'icon-picker' ), ), array( 'group' => 'text-editor', 'id' => 'genericon-attachment', 'name' => __( 'Attachment', 'icon-picker' ), ), array( 'group' => 'text-editor', 'id' => 'genericon-edit', 'name' => __( 'Edit', 'icon-picker' ), ), array( 'group' => 'text-editor', 'id' => 'genericon-code', 'name' => __( 'Code', 'icon-picker' ), ), array( 'group' => 'text-editor', 'id' => 'genericon-bold', 'name' => __( 'Bold', 'icon-picker' ), ), array( 'group' => 'text-editor', 'id' => 'genericon-italic', 'name' => __( 'Italic', 'icon-picker' ), ), array( 'group' => 'social', 'id' => 'genericon-codepen', 'name' => 'CodePen', ), array( 'group' => 'social', 'id' => 'genericon-digg', 'name' => 'Digg', ), array( 'group' => 'social', 'id' => 'genericon-dribbble', 'name' => 'Dribbble', ), array( 'group' => 'social', 'id' => 'genericon-dropbox', 'name' => 'DropBox', ), array( 'group' => 'social', 'id' => 'genericon-facebook', 'name' => 'Facebook', ), array( 'group' => 'social', 'id' => 'genericon-facebook-alt', 'name' => 'Facebook', ), array( 'group' => 'social', 'id' => 'genericon-flickr', 'name' => 'Flickr', ), array( 'group' => 'social', 'id' => 'genericon-foursquare', 'name' => 'Foursquare', ), array( 'group' => 'social', 'id' => 'genericon-github', 'name' => 'GitHub', ), array( 'group' => 'social', 'id' => 'genericon-googleplus', 'name' => 'Google+', ), array( 'group' => 'social', 'id' => 'genericon-googleplus-alt', 'name' => 'Google+', ), array( 'group' => 'social', 'id' => 'genericon-instagram', 'name' => 'Instagram', ), array( 'group' => 'social', 'id' => 'genericon-linkedin', 'name' => 'LinkedIn', ), array( 'group' => 'social', 'id' => 'genericon-linkedin-alt', 'name' => 'LinkedIn', ), array( 'group' => 'social', 'id' => 'genericon-path', 'name' => 'Path', ), array( 'group' => 'social', 'id' => 'genericon-pinterest', 'name' => 'Pinterest', ), array( 'group' => 'social', 'id' => 'genericon-pinterest-alt', 'name' => 'Pinterest', ), array( 'group' => 'social', 'id' => 'genericon-pocket', 'name' => 'Pocket', ), array( 'group' => 'social', 'id' => 'genericon-polldaddy', 'name' => 'PollDaddy', ), array( 'group' => 'social', 'id' => 'genericon-reddit', 'name' => 'Reddit', ), array( 'group' => 'social', 'id' => 'genericon-skype', 'name' => 'Skype', ), array( 'group' => 'social', 'id' => 'genericon-spotify', 'name' => 'Spotify', ), array( 'group' => 'social', 'id' => 'genericon-stumbleupon', 'name' => 'StumbleUpon', ), array( 'group' => 'social', 'id' => 'genericon-tumblr', 'name' => 'Tumblr', ), array( 'group' => 'social', 'id' => 'genericon-twitch', 'name' => 'Twitch', ), array( 'group' => 'social', 'id' => 'genericon-twitter', 'name' => 'Twitter', ), array( 'group' => 'social', 'id' => 'genericon-vimeo', 'name' => 'Vimeo', ), array( 'group' => 'social', 'id' => 'genericon-wordpress', 'name' => 'WordPress', ), array( 'group' => 'social', 'id' => 'genericon-youtube', 'name' => 'Youtube', ), ); /** * Filter genericon items * * @since 0.1.0 * @param array $items Icon names. */ $items = apply_filters( 'icon_picker_genericon_items', $items ); return $items; }
Get icon names @since 0.1.0 @return array
entailment
public function isValid($name, $password, $realm = null) { return ($name == $this->name) && ($password == $this->password); }
Checks for valid username & password @param string $name @param string $password @return boolean
entailment
public function parse() { if (array_key_exists('PHP_AUTH_USER', $_SERVER)) { // mod_php $this->name = $_SERVER['PHP_AUTH_USER']; $this->password = array_key_exists('PHP_AUTH_PW', $_SERVER) ? $_SERVER['PHP_AUTH_PW'] : null; } elseif (array_key_exists('HTTP_AUTHENTICATION', $_SERVER)) { // most other servers if (strpos(strtolower($_SERVER['HTTP_AUTHENTICATION']), 'basic') === 0) { $userdata = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHENTICATION'], 6))); list($this->name, $this->password) = $userdata; } } elseif (array_key_exists('REDIRECT_HTTP_AUTHORIZATION', $_SERVER)) { // most other servers if (strpos(strtolower($_SERVER['REDIRECT_HTTP_AUTHORIZATION']), 'basic') === 0) { $userdata = explode(':', base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6))); list($this->name, $this->password) = $userdata; } } }
Parses the User Information from server variables @return void
entailment
private function getQueryDefinitionCollection($context) { $variableName = ContentView::QUERY_DEFINITION_COLLECTION_NAME; if (is_array($context) && array_key_exists($variableName, $context)) { return $context[$variableName]; } throw new Twig_Error_Runtime( "Could not find QueryDefinitionCollection variable '{$variableName}'" ); }
Returns the QueryDefinitionCollection variable from the given $context. @throws \Twig_Error_Runtime @param mixed $context @return \Netgen\Bundle\EzPlatformSiteApiBundle\QueryType\QueryDefinitionCollection
entailment
public function get($fieldTypeIdentifier) { if (isset($this->resolverMap[$fieldTypeIdentifier])) { return $this->resolverMap[$fieldTypeIdentifier]; } throw new OutOfBoundsException( "No relation resolver is registered for field type identifier '{$fieldTypeIdentifier}'" ); }
Returns Resolver for $fieldTypeIdentifier. @throws \OutOfBoundsException When there is no resolver for the given $fieldTypeIdentifier @param string $fieldTypeIdentifier @return \Netgen\EzPlatformSiteApi\Core\Site\Plugins\FieldType\RelationResolver\Resolver
entailment
public function buildView(array $parameters) { $view = new ContentView(null, [], $parameters['viewType']); $view->setIsEmbed($this->isEmbed($parameters)); if ($view->isEmbed() && $parameters['viewType'] === null) { $view->setViewType(EmbedView::DEFAULT_VIEW_TYPE); } if (isset($parameters['locationId'])) { $location = $this->loadLocation($parameters['locationId']); } elseif (isset($parameters['location'])) { $location = $parameters['location']; if (!$location instanceof Location && $location instanceof APILocation) { $location = $this->loadLocation($location->id, false); } } else { $location = null; } if (isset($parameters['content'])) { $content = $parameters['content']; if (!$content instanceof Content && $content instanceof APIContent) { $content = $this->loadContent($content->contentInfo->id); } } else { if (isset($parameters['contentId'])) { $contentId = $parameters['contentId']; } elseif (isset($location)) { $contentId = $location->contentInfo->id; } else { throw new InvalidArgumentException( 'Content', 'No content could be loaded from parameters' ); } $content = $view->isEmbed() ? $this->loadEmbeddedContent($contentId, $location) : $this->loadContent($contentId); } $view->setSiteContent($content); if (isset($location)) { if ($location->contentInfo->id !== $content->id) { throw new InvalidArgumentException( 'Location', 'Provided location does not belong to selected content' ); } $view->setSiteLocation($location); } $this->viewParametersInjector->injectViewParameters($view, $parameters); $this->viewConfigurator->configure($view); return $view; }
@throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException If both contentId and locationId parameters are missing @throws \eZ\Publish\Core\Base\Exceptions\UnauthorizedException @param array $parameters @return \eZ\Publish\Core\MVC\Symfony\View\ContentView|\eZ\Publish\Core\MVC\Symfony\View\View If both contentId and locationId parameters are missing
entailment
private function loadEmbeddedContent($contentId, Location $location = null) { $repositoryLocation = null; /** @var \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo */ $contentInfo = $this->repository->sudo( function (Repository $repository) use ($contentId) { return $repository->getContentService()->loadContentInfo($contentId); } ); if ($location !== null) { $repositoryLocation = $location->innerLocation; } if (!$this->canRead($contentInfo, $repositoryLocation)) { throw new UnauthorizedException( 'content', 'read|view_embed', ['contentId' => $contentId, 'locationId' => $location !== null ? $location->id : 'n/a'] ); } // Check that Content is published, since sudo allows loading unpublished content. if ( !$contentInfo->published && !$this->authorizationChecker->isGranted( new AuthorizationAttribute('content', 'versionread', ['valueObject' => $contentInfo]) ) ) { throw new UnauthorizedException('content', 'versionread', ['contentId' => $contentId]); } return $this->site->getLoadService()->loadContent($contentId); }
Loads the embedded content with id $contentId. Will load the content with sudo(), and check if the user can view_embed this content, for the given location if provided. @throws \eZ\Publish\Core\Base\Exceptions\UnauthorizedException @param string|int $contentId @param \Netgen\EzPlatformSiteApi\API\Values\Location $location @return \Netgen\EzPlatformSiteApi\API\Values\Content
entailment
private function loadLocation($locationId, $checkVisibility = true) { $location = $this->repository->sudo( function (Repository $repository) use ($locationId) { return $this->site->getLoadService()->loadLocation($locationId); } ); if ($checkVisibility && $location->innerLocation->invisible) { throw new NotFoundHttpException( 'Location cannot be displayed as it is flagged as invisible.' ); } return $location; }
Loads a visible Location. @todo Do we need to handle permissions here ? @param string|int $locationId @param bool $checkVisibility @return \Netgen\EzPlatformSiteApi\API\Values\Location
entailment
private function canRead(ContentInfo $contentInfo, Location $location = null) { $limitations = ['valueObject' => $contentInfo]; if (isset($location)) { $limitations['targets'] = $location; } $readAttribute = new AuthorizationAttribute('content', 'read', $limitations); $viewEmbedAttribute = new AuthorizationAttribute('content', 'view_embed', $limitations); return $this->authorizationChecker->isGranted($readAttribute) || $this->authorizationChecker->isGranted($viewEmbedAttribute); }
Checks if a user can read a content, or view it as an embed. @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo @param $location @return bool
entailment
protected function getForwardRequest(Location $location, Content $content, SiteAccess $previewSiteAccess, Request $request, $language) { $request = parent::getForwardRequest($location, $content, $previewSiteAccess, $request, $language); $overrideViewAction = $this->configResolver->getParameter( 'override_url_alias_view_action', 'netgen_ez_platform_site_api' ); // If the preview siteaccess is configured in legacy_mode // we forward to the LegacyKernelController. // For compatibility with eZ Publish Legacy if ($this->isLegacyModeSiteAccess($previewSiteAccess->name)) { $request->attributes->set('_controller', 'ezpublish_legacy.controller:indexAction'); } elseif ($overrideViewAction) { $request->attributes->set('_controller', UrlAliasRouter::OVERRIDE_VIEW_ACTION); $this->injectSiteApiValueObjects($request, $language); } return $request; }
{@inheritdoc} @throws \Netgen\EzPlatformSiteApi\API\Exceptions\TranslationNotMatchedException
entailment
protected function injectSiteApiValueObjects(Request $request, $language) { /** @var \eZ\Publish\API\Repository\Values\Content\Content $content */ /** @var \eZ\Publish\API\Repository\Values\Content\Location $location */ $content = $request->attributes->get('content'); $location = $request->attributes->get('location'); $siteContent = $this->loadService->loadContent( $content->id, $content->versionInfo->versionNo, $language ); if (!$location->isDraft()) { $siteLocation = $this->loadService->loadLocation($location->id); } else { $siteLocation = new SiteLocation([ 'contentInfo' => $siteContent->contentInfo, 'innerLocation' => $location, ]); } $requestParams = $request->attributes->get('params'); $requestParams['content'] = $siteContent; $requestParams['location'] = $siteLocation; $request->attributes->set('content', $siteContent); $request->attributes->set('location', $siteLocation); $request->attributes->set('params', $requestParams); }
Injects the Site API value objects into request, replacing the original eZ API value objects. @throws \Netgen\EzPlatformSiteApi\API\Exceptions\TranslationNotMatchedException @param \Symfony\Component\HttpFoundation\Request $request @param string $language
entailment
protected function isLegacyModeSiteAccess($siteAccessName) { if (!$this->configResolver->hasParameter('legacy_mode', 'ezsettings', $siteAccessName)) { return false; } return $this->configResolver->getParameter('legacy_mode', 'ezsettings', $siteAccessName); }
Returns if the provided siteaccess is running in legacy mode. @param string $siteAccessName @return bool
entailment
public static function instance( $args = array() ) { if ( is_null( self::$instance ) ) { self::$instance = new self( $args ); } return self::$instance; }
Get instance @since 0.1.0 @param array $args Arguments {@see Icon_Picker::__construct()}. @return Icon_Picker
entailment
protected function register_default_types() { require_once "{$this->dir}/includes/fontpack.php"; Icon_Picker_Fontpack::instance(); /** * Allow themes/plugins to disable one or more default types * * @since 0.1.0 * @param array $default_types Default icon types. */ $default_types = array_filter( (array) apply_filters( 'icon_picker_default_types', $this->default_types ) ); /** * Validate filtered default types */ $default_types = array_intersect( $this->default_types, $default_types ); if ( empty( $default_types ) ) { return; } foreach ( $default_types as $filename => $class_suffix ) { $class_name = "Icon_Picker_Type_{$class_suffix}"; require_once "{$this->dir}/includes/types/{$filename}.php"; $this->registry->add( new $class_name() ); } }
Register default icon types @since 0.1.0 @access protected
entailment
public function load() { if ( true === $this->is_admin_loaded ) { return; } $this->loader->load(); $this->is_admin_loaded = true; }
Load icon picker functionality on an admin page @since 0.1.0 @return void
entailment
protected function configureOptions(OptionsResolver $resolver) { $resolver->setRequired('content'); $resolver->setAllowedTypes('content', SiteContent::class); $resolver->setDefined('exclude_self'); $resolver->setAllowedTypes('exclude_self', ['bool']); $resolver->setDefaults([ 'exclude_self' => true, ]); }
@inheritdoc @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException @throws \Symfony\Component\OptionsResolver\Exception\AccessException
entailment
protected function getFilterCriteria(array $parameters) { /** @var \Netgen\EzPlatformSiteApi\API\Values\Content $content */ $content = $parameters['content']; $tagIds = $this->extractTagIds($content); if (empty($tagIds)) { return new MatchNone(); } $criteria = []; $criteria[] = new TagId($tagIds); if ($parameters['exclude_self']) { $criteria[] = new LogicalNot(new ContentId($content->id)); } return $criteria; }
{@inheritdoc} @throws \LogicException @throws \OutOfBoundsException @throws \InvalidArgumentException @throws \RuntimeException
entailment
private function extractTagIds(SiteContent $content) { $tagsIdsGrouped = [[]]; foreach ($content->fields as $field) { if ($field->fieldTypeIdentifier !== 'eztags') { continue; } /** @var \Netgen\TagsBundle\Core\FieldType\Tags\Value $value */ $value = $field->value; $tagsIdsGrouped[] = array_map(function (TagValue $tag) {return $tag->id;}, $value->tags); } return array_merge(...$tagsIdsGrouped); }
Extract all Tag IDs from the given $content. @param \Netgen\EzPlatformSiteApi\API\Values\Content $content @return int[]|string[]
entailment
public function resolveTargets($name, array $parameters) { $definitionsGrouped = [[]]; foreach ($parameters as $target => $params) { $definitionsGrouped[] = $this->resolveForTarget($name, $target, $params); } return array_merge(...$definitionsGrouped); }
Resolve Field Criterion $parameters. @param string $name @param array $parameters @throws \InvalidArgumentException @return \Netgen\EzPlatformSiteApi\Core\Site\QueryType\CriterionDefinition[]
entailment
private function resolveForTarget($name, $target, $parameters) { if ($this->isOperatorMap($parameters)) { return $this->resolveOperatorMap($name, $target, $parameters); } return [ $this->buildDefinition($name, $target, null, $parameters), ]; }
Return CriterionDefinition instances for the given Field $target and its $parameters. @throws \InvalidArgumentException @param string $name @param string|null $target @param mixed $parameters @return \Netgen\EzPlatformSiteApi\Core\Site\QueryType\CriterionDefinition[]
entailment
private function resolveOperatorMap($name, $target, array $map) { $definitions = []; foreach ($map as $operator => $value) { if ('not' === $operator) { $definitions[] = $this->buildDefinition( 'not', null, null, $this->resolveForTarget($name, $target, $value) ); } else { $definitions[] = $this->buildDefinition($name, $target, $operator, $value); } } return $definitions; }
Return CriterionDefinition instances for the given Field $target and its operator $map. @param string $name @param string|null $target @param array $map @return \Netgen\EzPlatformSiteApi\Core\Site\QueryType\CriterionDefinition[]
entailment
private function buildDefinition($name, $target, $operator, $value) { return new CriterionDefinition([ 'name' => $name, 'target' => $target, 'operator' => $this->resolveOperator($operator, $value), 'value' => $value, ]); }
Return CriterionDefinition instance from the given arguments. @param string $name @param string|null $target @param string|null $operator @param mixed $value @return \Netgen\EzPlatformSiteApi\Core\Site\QueryType\CriterionDefinition
entailment
private function isOperatorMap($parameters) { if (!is_array($parameters)) { return false; } $isOperatorMap = false; $isValueCollection = false; foreach (array_keys($parameters) as $key) { if (array_key_exists($key, self::$operatorMap) || 'not' === $key) { $isOperatorMap = true; } else { $isValueCollection = true; } } if ($isOperatorMap && $isValueCollection) { throw new InvalidArgumentException( 'Array of parameters is ambiguous: it should be either an operator map or a value collection' ); } return $isOperatorMap; }
Decide if the given $parameters is an operator-value map (otherwise it's a value collection). @param mixed $parameters @throws \InvalidArgumentException @return bool
entailment
private function resolveOperator($symbol, $value) { if (null === $symbol) { return $this->getOperatorByValueType($value); } return self::$operatorMap[$symbol]; }
Resolve actual operator value from the given arguments. @param string|null $symbol @param mixed $value @return string
entailment
protected function getFilterCriteria(array $parameters) { $fields = (array) $parameters['relation_field']; if (empty($fields)) { return new MatchNone(); } /** @var \Netgen\EzPlatformSiteApi\API\Values\Content $content */ $content = $parameters['content']; $criteria = []; foreach ($fields as $identifier) { $criteria[] = new FieldRelation($identifier, Operator::CONTAINS, [$content->id]); } return $criteria; }
{@inheritdoc} @throws \LogicException @throws \OutOfBoundsException @throws \InvalidArgumentException @throws \RuntimeException
entailment
public function process(ContainerBuilder $container) { // 1. Register custom repositories with Aggregate repository $aggregateRepositoryDefinition = $container->findDefinition(static::$aggregateRepositoryId); $customRepositoryTags = $container->findTaggedServiceIds(static::$customRepositoryTag); $customRepositoryReferences = []; foreach (array_keys($customRepositoryTags) as $id) { $customRepositoryReferences[] = new Reference($id); } $aggregateRepositoryDefinition->replaceArgument(1, $customRepositoryReferences); $topEzRepositoryAlias = $container->getAlias(static::$topEzRepositoryAliasId); // 2. Re-link eZ Platform's public top Repository alias $container->setAlias(static::$renamedTopEzRepositoryAliasId, (string)$topEzRepositoryAlias); // 3. Overwrite eZ Platform's public top Repository alias // to aggregate Repository implementation $container->setAlias(static::$topEzRepositoryAliasId, static::$aggregateRepositoryId); }
@inheritdoc @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException @throws \Symfony\Component\DependencyInjection\Exception\OutOfBoundsException @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
entailment
private function validateUser(UserInterface $user) { return $user->isValid($this->username, $this->password, $this->realm); }
Checks for valid user @param User $user @return bool
entailment
private function getDirective() { switch (strtolower($this->type)) { case 'digest': return 'Digest ' . $this->buildDirectiveParameters(array( 'realm' => $this->realm, 'qop' => 'auth', 'nonce' => uniqid(), 'opaque' => md5($this->realm), )); default: return 'Basic ' . $this->buildDirectiveParameters(array( 'realm' => $this->realm )); } }
Return Directive according the auth type @return string
entailment
private function buildDirectiveParameters($parameters = array()) { $result = array(); foreach ($parameters as $key => $value) { $result[] = $key.'="'.$value.'"'; } return implode(',', $result); }
Format given parameters @param array $parameters @return string
entailment
public function isValid($name, $password, $realm) { $request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; $u1 = md5(sprintf('%s:%s:%s', $this->username, $realm, $password)); $u2 = md5(sprintf('%s:%s', $request_method, $this->uri)); $response = md5(sprintf('%s:%s:%s:%s:%s:%s', $u1, $this->nonce, $this->nc, $this->cnonce, $this->qop, $u2)); return ($response == $this->response) && ($name == $this->username); }
Checks for valid username & password @param string $name @param string $password @return boolean
entailment
public function parse() { $digest = $this->getDigest(); $user = array(); $required = array( 'nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1 ); preg_match_all('@(\w+)=(?:(?:")([^"]+)"|([^\s,$]+))@', $digest, $matches, PREG_SET_ORDER); if (is_array($matches)) { foreach ($matches as $m) { $key = $m[1]; $user[$key] = $m[2] ? $m[2] : $m[3]; unset($required[$key]); } if (count($required) == 0) { $this->nonce = $user['nonce']; $this->nc = $user['nc']; $this->cnonce = $user['cnonce']; $this->qop = $user['qop']; $this->username = $user['username']; $this->uri = $user['uri']; $this->response = $user['response']; } } }
Parses the User Information from server variables @return void
entailment
public function getDigest() { $digest = null; if (isset($_SERVER['PHP_AUTH_DIGEST'])) { $digest = $_SERVER['PHP_AUTH_DIGEST']; } elseif (isset($_SERVER['HTTP_AUTHORIZATION'])) { if (strpos(strtolower($_SERVER['HTTP_AUTHORIZATION']), 'digest') === 0) { $digest = substr($_SERVER['HTTP_AUTHORIZATION'], 7); } } return $digest; }
Fetch digest data from environment information @return string
entailment
public function renderField(Field $field, array $params = []) { $params = $this->getRenderFieldBlockParameters($field, $params); return $this->fieldBlockRenderer->renderContentFieldView( $field->innerField, $field->fieldTypeIdentifier, $params ); }
Renders the HTML for a given field. @throws InvalidArgumentException @param \Netgen\EzPlatformSiteApi\API\Values\Field $field @param array $params An array of parameters to pass to the field view @return string The HTML markup
entailment
private function getRenderFieldBlockParameters(Field $field, array $params = []) { // Merging passed parameters to default ones $params += [ 'parameters' => [], // parameters dedicated to template processing 'attr' => [], // attributes to add on the enclosing HTML tags ]; $content = $field->content->innerContent; $contentType = $field->content->contentInfo->innerContentType; $fieldDefinition = $contentType->getFieldDefinition($field->fieldDefIdentifier); $params += [ 'field' => $field->innerField, 'content' => $content, 'contentInfo' => $content->getVersionInfo()->getContentInfo(), 'versionInfo' => $content->getVersionInfo(), 'fieldSettings' => $fieldDefinition->getFieldSettings(), ]; // Adding field type specific parameters if any. if ($this->parameterProviderRegistry->hasParameterProvider($fieldDefinition->fieldTypeIdentifier)) { $params['parameters'] += $this->parameterProviderRegistry ->getParameterProvider($fieldDefinition->fieldTypeIdentifier) ->getViewParameters($field->innerField); } // make sure we can easily add class="<fieldtypeidentifier>-field" to the // generated HTML if (isset($params['attr']['class'])) { $params['attr']['class'] .= " {$field->fieldTypeIdentifier}-field"; } else { $params['attr']['class'] = "{$field->fieldTypeIdentifier}-field"; } return $params; }
Generates the array of parameter to pass to the field template. @param \Netgen\EzPlatformSiteApi\API\Values\Field $field the Field to display @param array $params An array of parameters to pass to the field view @return array
entailment
protected function makeRequest($http_verb, $api_method, $args = [], $timeout = 10, $url = null) { $this->checkDependencies(); $url = $this->constructRequestUrl($url, $api_method); $ch = $this->createCurlSession($url, $timeout); switch ($http_verb) { case 'post': curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($args)); break; case 'get': curl_setopt($ch, CURLOPT_URL, $url . '?' . http_build_query($args)); break; case 'delete': curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); break; } return $this->executeRequest($ch); }
Make the HTTP request @param string $http_verb HTTP method used: get, post, delete @param string $api_method Drip API method to call @param array $args Array of arguments to the API method @param int $timeout Connection timeout (seconds) @param string $url Optional URL to override the constructed one @return Response @throws DripException
entailment
private function constructRequestUrl($url, $api_method) { if ($url !== null) { return $url; } if ($this->accountID === null) { throw new DripException("This method requires an account ID and none has been set.", 2); } return $this->api_endpoint . '/' . $this->accountID . '/' . $api_method; }
@param string|null $url @param string $api_method @return string @throws DripException
entailment
private function createCurlSession($url, $timeout = 10) { $ch = curl_init(); if (!$ch) { throw new DripException("Unable to initialise curl", 3); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Accept: application/vnd.api+json', 'Content-Type: application/vnd.api+json', ]); curl_setopt($ch, CURLOPT_USERAGENT, 'DrewM/Drip (github.com/drewm/drip)'); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $this->token . ': '); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verify_ssl); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($ch, CURLOPT_URL, $url); return $ch; }
Create a new CURL session (common setup etc) @param string $url @param int $timeout @return resource @throws DripException
entailment
private function executeRequest(&$ch) { $result = curl_exec($ch); if (!curl_errno($ch)) { $info = curl_getinfo($ch); curl_close($ch); return new Response($info, $result); } $errno = curl_errno($ch); $error = curl_error($ch); curl_close($ch); throw new DripException($error, $errno); }
Execute and handle the request result @param resource $ch Curl handle @return Response @throws DripException
entailment
public function getGlobal($api_method, $args = [], $timeout = 10) { $url = $this->api_endpoint . '/' . $api_method; return $this->makeRequest('get', $api_method, $args, $timeout, $url); }
Make a GET request to a top-level method outside of this account @param string $api_method @param array $args @param int $timeout @return Response @throws DripException
entailment
protected function configureOptions(OptionsResolver $resolver) { $resolver->remove(['depth', 'parent_location_id', 'subtree']); $resolver->setRequired('location'); $resolver->setAllowedTypes('location', SiteLocation::class); $resolver->setDefault('sort', function (Options $options) { /** @var \Netgen\EzPlatformSiteApi\API\Values\Location $location */ $location = $options['location']; return $location->innerLocation->getSortClauses(); }); }
{@inheritdoc} @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException @throws \Symfony\Component\OptionsResolver\Exception\AccessException
entailment
protected function configureOptions(OptionsResolver $resolver) { $resolver->setRequired([ 'content', 'relation_field', ]); $resolver->setAllowedTypes('content', SiteContent::class); $resolver->setAllowedTypes('relation_field', ['string', 'array']); $resolver->setAllowedValues( 'relation_field', function ($fields) { if (!is_array($fields)) { return true; } foreach ($fields as $field) { if (!is_string($field)) { return false; } } return true; } ); $resolver->setDefined('exclude_self'); $resolver->setAllowedTypes('exclude_self', ['bool']); $resolver->setDefaults([ 'exclude_self' => true, ]); }
@inheritdoc @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException @throws \Symfony\Component\OptionsResolver\Exception\AccessException
entailment
private function extractTagIds(SiteContent $content, array $fields) { $tagsIdsGrouped = [[]]; foreach ($fields as $identifier) { if (!$content->hasField($identifier)) { throw new InvalidArgumentException( "Content does not contain field '{$identifier}'" ); } $field = $content->getField($identifier); if ($field->fieldTypeIdentifier !== 'eztags') { throw new InvalidArgumentException( "Field '{$identifier}' is not of 'eztags' type" ); } /** @var $value \Netgen\TagsBundle\Core\FieldType\Tags\Value */ $value = $field->value; $tagsIdsGrouped[] = array_map(function (Tag $tag) {return $tag->id;}, $value->tags); } return array_merge(...$tagsIdsGrouped); }
Extract Tag IDs from $fields in the given $content. @param \Netgen\EzPlatformSiteApi\API\Values\Content $content @param string[] $fields @throws \InvalidArgumentException @return array
entailment
public function map(array $configuration, ContentView $view) { if (isset($configuration['named_query'])) { $namedQueryConfiguration = $this->getNamedQueryConfiguration($configuration['named_query']); $configuration = $this->overrideConfiguration($namedQueryConfiguration, $configuration); } return $this->buildQueryDefinition($configuration, $view); }
Map given $configuration in $view context to a QueryDefinition instance. @param array $configuration @param \Netgen\Bundle\EzPlatformSiteApiBundle\View\ContentView $view @throws \InvalidArgumentException @return \Netgen\Bundle\EzPlatformSiteApiBundle\QueryType\QueryDefinition
entailment
private function overrideConfiguration(array $configuration, array $override) { $configuration['parameters'] = array_replace( $configuration['parameters'], $override['parameters'] ); unset($override['parameters']); return array_replace($configuration, $override); }
Override $configuration parameters with $override. Only first level keys in main configuration and separately under 'parameters' key are replaced. @param array $configuration @param array $override @return array
entailment
private function getNamedQueryConfiguration($name) { if (array_key_exists($name, $this->namedQueryConfiguration)) { return $this->namedQueryConfiguration[$name]; } throw new InvalidArgumentException( "Could not find query configuration named '{$name}'" ); }
Return named query configuration by the given $name. @param string $name @throws \InvalidArgumentException If no such configuration exist. @return array
entailment
private function buildQueryDefinition(array $configuration, ContentView $view) { $parameters = $this->processParameters($configuration['parameters'], $view); $this->injectSupportedParameters($parameters, $configuration['query_type'], $view); return new QueryDefinition([ 'name' => $configuration['query_type'], 'parameters' => $parameters, 'useFilter' => $this->parameterProcessor->process($configuration['use_filter'], $view), 'maxPerPage' => $this->parameterProcessor->process($configuration['max_per_page'], $view), 'page' => $this->parameterProcessor->process($configuration['page'], $view), ]); }
Build QueryDefinition instance from the given arguments. @param array $configuration @param \Netgen\Bundle\EzPlatformSiteApiBundle\View\ContentView $view @return \Netgen\Bundle\EzPlatformSiteApiBundle\QueryType\QueryDefinition
entailment
private function injectSupportedParameters(array &$parameters, $queryTypeName, ContentView $view) { $queryType = $this->queryTypeRegistry->getQueryType($queryTypeName); if (!$queryType instanceof SiteQueryType) { return; } if (!array_key_exists('content', $parameters) && $queryType->supportsParameter('content')) { $parameters['content'] = $view->getSiteContent(); } if (!array_key_exists('location', $parameters) && $queryType->supportsParameter('location')) { $parameters['location'] = $view->getSiteLocation(); } }
Inject parameters into $parameters if available in the $view and supported by the QueryType. @param array $parameters @param string $queryTypeName @param \Netgen\Bundle\EzPlatformSiteApiBundle\View\ContentView $view
entailment
private function processParameters($parameters, ContentView $view) { if (!is_array($parameters)) { return $this->parameterProcessor->process($parameters, $view); } $processedParameters = []; foreach ($parameters as $name => $subParameters) { $processedParameters[$name] = $this->processParameters($subParameters, $view); } return $processedParameters; }
Recursively process given $parameters using ParameterProcessor. @see \Netgen\Bundle\EzPlatformSiteApiBundle\QueryType\ParameterProcessor @param mixed $parameters @param \Netgen\Bundle\EzPlatformSiteApiBundle\View\ContentView $view @return array|string
entailment
public function getRelationIds(Field $field) { if (!$this->accept($field)) { $identifier = $this->getSupportedFieldTypeIdentifier(); throw new LogicException( "This resolver can only handle fields of '{$identifier}' type" ); } return $this->getRelationIdsFromValue($field->value); }
Return related Content IDs for the given $field. @throws \LogicException If the field can't be handled by the resolver @param \Netgen\EzPlatformSiteApi\API\Values\Field $field @return int[]|string[]
entailment
private function getRelatedContentItems(array $relatedContentIds, array $contentTypeIdentifiers) { if (count($relatedContentIds) === 0) { return []; } $criteria = new ContentId($relatedContentIds); if (!empty($contentTypeIdentifiers)) { $criteria = new LogicalAnd([ $criteria, new ContentTypeIdentifier($contentTypeIdentifiers), ]); } $query = new Query([ 'filter' => $criteria, 'limit' => count($relatedContentIds), ]); $searchResult = $this->site->getFilterService()->filterContent($query); /** @var \eZ\Publish\API\Repository\Values\Content\Content[] $contentItems */ $contentItems = $this->extractValueObjects($searchResult); return $contentItems; }
Return an array of related Content from the given arguments. @throws \InvalidArgumentException As thrown by the Search API @param array $relatedContentIds @param array $contentTypeIdentifiers @return \eZ\Publish\API\Repository\Values\Content\Content[]
entailment
private function sortByIdOrder(array &$relatedContentItems, array $relatedContentIds) { $sortedIdList = array_flip($relatedContentIds); $sorter = function (Content $content1, Content $content2) use ($sortedIdList) { if ($content1->id === $content2->id) { return 0; } return ($sortedIdList[$content1->id] < $sortedIdList[$content2->id]) ? -1 : 1; }; usort($relatedContentItems, $sorter); }
Sorts $relatedContentItems to match order from $relatedContentIds. @param array $relatedContentItems @param array $relatedContentIds
entailment
public function add( Icon_Picker_Type $type ) { if ( $this->is_valid_type( $type ) ) { $this->types[ $type->id ] = $type; } }
Register icon type @since 0.1.0 @param Icon_Picker_Type $type Icon type. @return void
entailment
public function get( $id ) { if ( isset( $this->types[ $id ] ) ) { return $this->types[ $id ]; } return null; }
Get icon type @since 0.1.0 @param string $id Icon type ID. @return mixed Icon type or NULL if it's not registered.
entailment
protected function is_valid_type( Icon_Picker_Type $type ) { foreach ( array( 'id', 'controller' ) as $var ) { $value = $type->$var; if ( empty( $value ) ) { trigger_error( esc_html( sprintf( 'Icon Picker: "%s" cannot be empty.', $var ) ) ); return false; } } if ( isset( $this->types[ $type->id ] ) ) { trigger_error( esc_html( sprintf( 'Icon Picker: Icon type %s is already registered. Please use a different ID.', $type->id ) ) ); return false; } return true; }
Check if icon type is valid @since 0.1.0 @param Icon_Picker_Type $type Icon type. @return bool
entailment
public function get_types_for_js() { $types = array(); $names = array(); foreach ( $this->types as $type ) { $types[ $type->id ] = $type->get_props(); $names[ $type->id ] = $type->name; } array_multisort( $names, SORT_ASC, $types ); return $types; }
Get all icon types for JS @since 0.1.0 @return array
entailment
public function register() { // merge default config $this->mergeConfigFrom( __DIR__.'/../../config/config.php', 'httpauth' ); $this->app->singleton('httpauth', function ($app) { return new Httpauth($app['config']->get('httpauth')); }); }
Register the service provider. @return void
entailment
public function get_props() { $props = array( 'id' => $this->id, 'name' => $this->name, 'controller' => $this->controller, 'templateId' => $this->template_id, 'data' => $this->get_props_data(), ); /** * Filter icon type properties * * @since 0.1.0 * @param array $props Icon type properties. * @param string $id Icon type ID. * @param Icon_Picker_Type $type Icon_Picker_Type object. */ $props = apply_filters( 'icon_picker_type_props', $props, $this->id, $this ); /** * Filter icon type properties * * @since 0.1.0 * @param array $props Icon type properties. * @param Icon_Picker_Type $type Icon_Picker_Type object. */ $props = apply_filters( "icon_picker_type_props_{$this->id}", $props, $this ); return $props; }
Get properties @since 0.1.0 @return array
entailment
public function register() { $this->app['httpauth'] = $this->app->share(function ($app) { return new Httpauth($app['config']->get('httpauth::config')); }); }
Register the service provider. @return void
entailment
public function load(array $configs, ContainerBuilder $container) { $activatedBundles = array_keys($container->getParameter('kernel.bundles')); $configuration = $this->getConfiguration($configs, $container); $config = $this->processConfiguration($configuration, $configs); $coreFileLocator = new FileLocator(__DIR__ . '/../../lib/Resources/config'); $coreLoader = new Loader\YamlFileLoader($container, $coreFileLocator); $coreLoader->load('services.yml'); if (in_array('NetgenTagsBundle', $activatedBundles, true)) { $coreLoader->load('query_types/netgen_tags_dependant.yml'); } $fileLocator = new FileLocator(__DIR__ . '/../Resources/config'); $loader = new Loader\YamlFileLoader($container, $fileLocator); $loader->load('services.yml'); $loader->load('view.yml'); $processor = new ConfigurationProcessor($container, $this->getAlias()); $processor->mapConfig( $config, function ($scopeSettings, $currentScope, ContextualizerInterface $contextualizer) { foreach ($scopeSettings as $key => $value) { $contextualizer->setContextualParameter($key, $currentScope, $value); } } ); if (!$container->hasParameter('ezsettings.default.ngcontent_view')) { // Default value for ngcontent_view template rules // Setting this through the config file causes issues in eZ kernel 6.11+ $container->setParameter('ezsettings.default.ngcontent_view', []); } }
{@inheritdoc} @throws \Exception
entailment
public function getSlice($offset, $length) { $query = clone $this->query; $query->offset = $offset; $query->limit = $length; $query->performCount = false; $searchResult = $this->filterService->filterContent($query); // Set count for further use if returned by search engine despite !performCount (Solr, ES) if (null === $this->nbResults && null !== $searchResult->totalCount) { $this->nbResults = $searchResult->totalCount; } $list = []; foreach ($searchResult->searchHits as $hit) { $list[] = $hit->valueObject; } return $list; }
Returns a slice of the results, as Site Content objects. @param int $offset The offset @param int $length The length @return \Netgen\EzPlatformSiteApi\API\Values\Location[]
entailment
protected function get_image_mime_types() { $mime_types = get_allowed_mime_types(); foreach ( $mime_types as $id => $type ) { if ( false === strpos( $type, 'image/' ) ) { unset( $mime_types[ $id ] ); } } /** * Filter image mime types * * @since 0.1.0 * @param array $mime_types Image mime types. */ $mime_types = apply_filters( 'icon_picker_image_mime_types', $mime_types ); // We need to exclude image/svg*. unset( $mime_types['svg'] ); return $mime_types; }
Get image mime types @since 0.1.0 @return array
entailment