* @license GNU General Public License, version 2 * @link http://addthis.com AddThis website */ class AddThisRecommendedContentVerticalTool extends AddThisRecommendedContentToolParent { public $boostApiClass = 'addthis_recommended_vertical'; public $prettyName = 'Vertical Recommended Content'; public $edition = 'basic'; public $clientApiSupport = false; public $inline = true; public $settingsSubVariableName = 'smlrebv'; public $widgetClassName = 'AddThisRecommendedContentVerticalWidget'; public $widgetBaseId = 'addthis_recommended_vertical_widget'; public $widgetName = 'Recommended Content - Vertical'; public $widgetDescription = ' Vertical recommended content from AddThis to showcase trending or related content and images to keep visitors engaged and on your site. '; public $defaultWidgetTitle = 'Recommended Content'; public $shortCode = 'addthis_vertical_recommended_content'; protected $defaultConfigs = array( 'enabled' => false, 'title' => 'Recommended for you', 'theme' => 'transparent', 'maxitems' => 4, 'elements' => 'addthis_recommended_vertical', ); /** * This must be public as it's used in the feature object with this tool * * This takes form input for a tool sub settings variable, manipulates * it, and returns the variables that should be saved to the database. * * @param array $input An associative array of values * input for this tools' settings * @param boolean $addDefaultConfigs Whether to populate in default * values for missing fields * * @return array A cleaned up associative array of settings specific to * this feature. */ public function sanitizeSettings($input, $addDefaultConfigs = true) { $output = array(); if (is_array($input)) { foreach ($input as $field => $value) { switch ($field) { case 'enabled': $output[$field] = (boolean)$value; break; case 'title': // same as next case 'theme': $output[$field] = sanitize_text_field($value); break; case 'maxitems': $output[$field] = (int)$value; break; } } } if ($addDefaultConfigs) { $output = $this->addDefaultConfigs($output); } return $output; } } }