示例#1
0
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['id' => '', 'title' => Translate::t('text.title', [], 'textfield'), 'default' => '', 'description' => '', 'options' => ['type' => 'text', 'min' => '', 'max' => '', 'step' => ''], 'attrs' => '', 'placeholder' => '', 'maxlength' => ''];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     // Retrieve field value
     $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);
     // Attributes
     $vars['attrs'] = 'size="30"';
     $vars['attrs'] .= !empty($vars['placeholder']) ? ' placeholder="' . $vars['placeholder'] . '"' : '';
     $vars['attrs'] .= !empty($vars['maxlength']) ? ' maxlength="' . $vars['maxlength'] . '"' : '';
     // Check type
     $type = !empty($vars['options']['type']) ? $vars['options']['type'] : 'text';
     $vars['type'] = $type;
     // Check options
     if ('number' === $type || 'range' === $type) {
         // Special variables
         $vars['attrs'] .= !empty($vars['options']['min']) ? ' min="' . $vars['options']['min'] . '"' : '';
         $vars['attrs'] .= !empty($vars['options']['max']) ? ' max="' . $vars['options']['max'] . '"' : '';
         $vars['attrs'] .= !empty($vars['options']['step']) ? ' step="' . $vars['options']['step'] . '"' : ' step="1"';
     }
     // Update vars
     $this->getModel()->setVars($vars);
 }
示例#2
0
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  *
  * @since 0.0.1
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['title' => Translate::t('file.title', [], 'filefield'), 'file' => false];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     // Update vars
     $this->getModel()->setVars($vars);
 }
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['id' => '', 'title' => Translate::t('textarea.title', [], 'textareafield'), 'default' => '', 'description' => '', 'placeholder' => '', 'rows' => 8];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     // Retrieve field value
     $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);
     // Update vars
     $this->getModel()->setVars($vars);
 }
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['id' => '', 'title' => Translate::t('select.title', [], 'selectfield'), 'default' => '', 'description' => '', 'options' => [], 't_no_options' => Translate::t('select.no_options', [], 'selectfield')];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     // Retrieve field value
     $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);
     // Update vars
     $this->getModel()->setVars($vars);
 }
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['id' => '', 'title' => Translate::t('toggle.title', [], 'togglefield'), 'default' => false, 'description' => '', 'enable' => '', 'disable' => '', 't_on' => Translate::t('toggle.on', [], 'togglefield'), 't_off' => Translate::t('toggle.off', [], 'togglefield')];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     // Retrieve field value
     $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);
     // Update vars
     $this->getModel()->setVars($vars);
 }
示例#6
0
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['id' => '', 'title' => Translate::t('link.title', [], 'linkfield'), 'default' => [], 'description' => '', 'expandable' => false, 't_add_link' => Translate::t('link.add_link', [], 'linkfield'), 't_delete_all' => Translate::t('link.delete_all', [], 'linkfield'), 't_relationship' => Translate::t('link.relationship.title', [], 'linkfield'), 't_relationship_description' => Translate::t('link.relationship.description', [], 'linkfield'), 't_target' => Translate::t('link.target.title', [], 'linkfield'), 't_target_blank' => Translate::t('link.target.blank', [], 'linkfield'), 't_target_self' => Translate::t('link.target.self', [], 'linkfield'), 't_target_parent' => Translate::t('link.target.parent', [], 'linkfield'), 't_target_top' => Translate::t('link.target.top', [], 'linkfield'), 't_website' => Translate::t('link.website.title', [], 'linkfield'), 't_website_address' => Translate::t('link.website.address', [], 'linkfield'), 't_website_placeholder' => Translate::t('link.website.placeholder', [], 'linkfield'), 't_website_goto' => Translate::t('link.website.goto', [], 'linkfield')];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     // Retrieve field value
     $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);
     $vars['val'] = is_array($vars['val']) ? $vars['val'] : [$template['val']];
     // Update vars
     $this->getModel()->setVars($vars);
 }
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['id' => '', 'title' => Translate::t('checkbox.title', [], 'checkboxfield'), 'description' => '', 'default' => [], 'mode' => '', 'options' => [], 't_check_all' => Translate::t('checkbox.check_all', [], 'checkboxfield'), 't_no_options' => Translate::t('checkbox.no_otions', [], 'checkboxfield')];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     $vars['count'] = count($vars['options']);
     // Retrieve field value
     $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);
     $vars['val'] = !is_array($vars['val']) ? [$vars['val']] : $vars['val'];
     // Update vars
     $this->getModel()->setVars($vars);
 }
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['id' => '', 'title' => Translate::t('upload.title', [], 'uploadfield'), 'default' => [], 'description' => '', 'library' => 'image', 'multiple' => false, 'expand' => false, 'alt' => '', 'caption' => '', 'can_upload' => current_user_can('upload_files'), 't_add_media' => Translate::t('upload.add_media', [], 'uploadfield'), 't_add_medias' => Translate::t('upload.add_medias', [], 'uploadfield'), 't_delete_item' => Translate::t('upload.delete_selection', [], 'uploadfield'), 't_delete_all' => Translate::t('upload.delete_all', [], 'uploadfield'), 't_cannot_upload' => Translate::t('upload.cannot_upload', [], 'uploadfield'), 't_sizes' => Translate::t('upload.sizes.title', [], 'uploadfield'), 't_size_full' => Translate::t('upload.sizes.full', [], 'uploadfield'), 't_alt' => Translate::t('upload.alt', [], 'uploadfield'), 't_caption' => Translate::t('upload.caption', [], 'uploadfield')];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     // Special case
     $vars['library'] = 'pdf' === $vars['library'] ? 'application/pdf' : $vars['library'];
     // Retrieve field value
     $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);
     // Update vars
     $this->getModel()->setVars($vars);
 }
示例#9
0
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['id' => '', 'title' => Translate::t('font.title', [], 'fontfield'), 'default' => '', 'description' => '', 'fonts' => false, 'api_key' => '', 'styles' => '', 'css' => '', 't_populars' => Translate::t('font.populars', [], 'fontfield'), 't_others' => Translate::t('font.others', [], 'fontfield')];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     // Retirve all fonts
     $vars['options'] = $this->getFontGoogle($vars['api_key']);
     // Retrieve field value
     $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);
     // Update vars
     $this->getModel()->setVars($vars);
 }
示例#10
0
 /**
  * Prepare HTML component.
  *
  * @param array $content
  * @param array $details
  */
 protected function getVars($content, $details = [])
 {
     // Build defaults
     $defaults = ['id' => '', 'default' => '', 'description' => '', 'display' => true];
     // Build defaults data
     $vars = array_merge($defaults, $content);
     // Retrieve field value
     $vars['val'] = $this->getValue($content['id'], $details, $vars['default']);
     // Get description
     if ($vars['display'] && !is_array($vars['val'])) {
         $vars['description'] = sprintf(Translate::t('hidden.description.show', [], 'hiddenfield'), $content['id'], $vars['val']);
     } else {
         $vars['description'] = sprintf(Translate::t('hidden.description.hide', [], 'hiddenfield'), $content['id']);
     }
     // Update vars
     $this->getModel()->setVars($vars);
 }
 /**
  * Get WordPress Terms registered.
  *
  * @uses get_terms()
  *
  * @param   array $options      Define options if needed
  * @return  array $wpcontents   Array of WordPress items
  */
 protected function getWPTerms($options = [])
 {
     // Build contents
     $contents = [];
     $contents[-1] = Translate::t('wordpress.choose.term', [], 'wordpressfield');
     // Build options
     $args = array_merge(['public' => 1], $options);
     // Build request
     $taxs_obj = get_taxonomies($args);
     // Iterate on tags
     if (!empty($taxs_obj)) {
         foreach ($taxs_obj as $tax) {
             // Get the id and the name
             $taxo = get_taxonomy($tax);
             $contents[0][$tax] = $taxo->labels->name . ' (' . $taxo->name . ')';
         }
     }
     // Return all values in a well formatted way
     return $contents;
 }
示例#12
0
 /**
  * Return all available Social networks.
  *
  * @return array $socials
  */
 protected function getSocialNetworks()
 {
     return ['twitter' => ['url' => 'http://www.twitter.com/', 'title' => Translate::t('social.networks.twitter.title', [], 'socialfield'), 'value' => Translate::t('social.networks.twitter.value', [], 'socialfield'), 'placeholder' => 'http://www.twitter.com/__username__', 'color' => '#55acee'], 'facebook' => ['url' => 'http://www.facebook.com/', 'title' => Translate::t('social.networks.facebook.title', [], 'socialfield'), 'value' => Translate::t('social.networks.facebook.value', [], 'socialfield'), 'placeholder' => 'http://www.facebook.com/__username__', 'color' => '#3b5998'], 'instagram' => ['url' => 'http://www.instagram.com/', 'title' => Translate::t('social.networks.instagram.title', [], 'socialfield'), 'value' => Translate::t('social.networks.instagram.value', [], 'socialfield'), 'placeholder' => 'http://www.instagram.com/__username__', 'color' => '#3f729b'], 'linkedin' => ['url' => 'http://www.linkedin.com/', 'title' => Translate::t('social.networks.linkedin.title', [], 'socialfield'), 'value' => Translate::t('social.networks.linkedin.value', [], 'socialfield'), 'placeholder' => 'http://www.linkedin.com/in/__username__', 'color' => '#0077b5'], 'snapchat' => ['url' => 'https://www.snapchat.com/', 'title' => Translate::t('social.networks.snapchat.title', [], 'socialfield'), 'value' => Translate::t('social.networks.snapchat.value', [], 'socialfield'), 'placeholder' => 'https://www.snapchat.com/add/__username__', 'color' => '#ffff00', 'icon' => 'snapchat-ghost'], '500px' => ['url' => 'https://500px.com/', 'title' => Translate::t('social.networks.500px.title', [], 'socialfield'), 'value' => Translate::t('social.networks.500px.value', [], 'socialfield'), 'placeholder' => 'https://500px.com/__username__', 'color' => '#0099e5'], 'behance' => ['url' => 'http://www.behance.com/', 'title' => Translate::t('social.networks.behance.title', [], 'socialfield'), 'value' => Translate::t('social.networks.behance.value', [], 'socialfield'), 'placeholder' => 'http://www.behance.com/__username__', 'color' => '#1769ff'], 'bitbucket' => ['url' => 'https://bitbucket.org/', 'title' => Translate::t('social.networks.bitbucket.title', [], 'socialfield'), 'value' => Translate::t('social.networks.bitbucket.value', [], 'socialfield'), 'placeholder' => 'https://bitbucket.org/__username__', 'color' => '#205081'], 'codepen' => ['url' => 'http://codepen.io/', 'title' => Translate::t('social.networks.codepen.title', [], 'socialfield'), 'value' => Translate::t('social.networks.codepen.value', [], 'socialfield'), 'placeholder' => 'http://codepen.io/__username__', 'color' => '#000000'], 'delicious' => ['url' => 'https://delicious.com/', 'title' => Translate::t('social.networks.delicious.title', [], 'socialfield'), 'value' => Translate::t('social.networks.delicious.value', [], 'socialfield'), 'placeholder' => 'https://delicious.com/__username__', 'color' => '#3399ff'], 'deviantart' => ['url' => 'http://www.deviantart.com/', 'title' => Translate::t('social.networks.deviantart.title', [], 'socialfield'), 'value' => Translate::t('social.networks.deviantart.value', [], 'socialfield'), 'placeholder' => 'http://__username__.deviantart.com/', 'color' => '#05cc47'], 'dribbble' => ['url' => 'http://dribbble.com/', 'title' => Translate::t('social.networks.dribbble.title', [], 'socialfield'), 'value' => Translate::t('social.networks.dribbble.value', [], 'socialfield'), 'placeholder' => 'http://dribbble.com/__username__', 'color' => '#ea4c89'], 'flickr' => ['url' => 'http://www.flickr.com/', 'title' => Translate::t('social.networks.flickr.title', [], 'socialfield'), 'value' => Translate::t('social.networks.flickr.value', [], 'socialfield'), 'placeholder' => 'http://www.flickr.com/photos/__username__', 'color' => '#0063dc'], 'foursquare' => ['url' => 'https://www.foursquare.com/', 'title' => Translate::t('social.networks.foursquare.title', [], 'socialfield'), 'value' => Translate::t('social.networks.foursquare.value', [], 'socialfield'), 'placeholder' => 'https://www.foursquare.com/__username__', 'color' => '#f94877'], 'gittip' => ['url' => 'https://www.gittip.com/', 'title' => Translate::t('social.networks.gittip.title', [], 'socialfield'), 'value' => Translate::t('social.networks.gittip.value', [], 'socialfield'), 'placeholder' => 'https://www.gittip.com/__username__', 'color' => '#663300'], 'github' => ['url' => 'https://github.com/', 'title' => Translate::t('social.networks.github.title', [], 'socialfield'), 'value' => Translate::t('social.networks.github.value', [], 'socialfield'), 'placeholder' => 'https://github.com/__username__', 'color' => '#333333'], 'google' => ['url' => 'http://plus.google.com/', 'title' => Translate::t('social.networks.google.title', [], 'socialfield'), 'value' => Translate::t('social.networks.google.value', [], 'socialfield'), 'placeholder' => 'http://plus.google.com/__username__', 'color' => '#dc4e41', 'icon' => 'google-plus'], 'gratipay' => ['url' => 'https://gratipay.com/', 'title' => Translate::t('social.networks.gratipay.title', [], 'socialfield'), 'value' => Translate::t('social.networks.gratipay.value', [], 'socialfield'), 'placeholder' => 'https://gratipay.com/__username__', 'color' => '#6c2e00'], 'lastfm' => ['url' => 'http://www.lastfm.fr/', 'title' => Translate::t('social.networks.lastfm.title', [], 'socialfield'), 'value' => Translate::t('social.networks.lastfm.value', [], 'socialfield'), 'placeholder' => 'http://www.lastfm.fr/user/__username__', 'color' => '#d51007'], 'pinterest' => ['url' => 'http://pinterest.com/', 'title' => Translate::t('social.networks.pinterest.title', [], 'socialfield'), 'value' => Translate::t('social.networks.pinterest.value', [], 'socialfield'), 'placeholder' => 'http://pinterest.com/__username__', 'color' => '#bd081c'], 'reddit' => ['url' => 'http://www.reddit.com/', 'title' => Translate::t('social.networks.reddit.title', [], 'socialfield'), 'value' => Translate::t('social.networks.reddit.value', [], 'socialfield'), 'placeholder' => 'http://www.reddit.com/user/__username__', 'color' => '#ff4500'], 'skype' => ['url' => 'http://www.skype.com/', 'title' => Translate::t('social.networks.skype.title', [], 'socialfield'), 'value' => Translate::t('social.networks.skype.value', [], 'socialfield'), 'placeholder' => '__username__', 'color' => '#00aff0'], 'soundcloud' => ['url' => 'https://soundcloud.com/', 'title' => Translate::t('social.networks.soundcloud.title', [], 'socialfield'), 'value' => Translate::t('social.networks.soundcloud.value', [], 'socialfield'), 'placeholder' => 'https://soundcloud.com/__username__', 'color' => '#ff3300'], 'spotify' => ['url' => 'https://spotify.com/', 'title' => Translate::t('social.networks.spotify.title', [], 'socialfield'), 'value' => Translate::t('social.networks.spotify.value', [], 'socialfield'), 'placeholder' => 'https://open.spotify.com/user/__username__', 'color' => '#1db954'], 'steam' => ['url' => 'http://store.steampowered.com/', 'title' => Translate::t('social.networks.steam.title', [], 'socialfield'), 'value' => Translate::t('social.networks.steam.value', [], 'socialfield'), 'placeholder' => 'http://steamcommunity.com/id/__username__', 'color' => '#231f20'], 'stumbleupon' => ['url' => 'http://www.stumbleupon.com/', 'title' => Translate::t('social.networks.stumbleupon.title', [], 'socialfield'), 'value' => Translate::t('social.networks.stumbleupon.value', [], 'socialfield'), 'placeholder' => 'http://www.stumbleupon.com/stumbler/__username__', 'color' => '#eb4924'], 'tumblr' => ['url' => 'https://www.tumblr.com/', 'title' => Translate::t('social.networks.tumblr.title', [], 'socialfield'), 'value' => Translate::t('social.networks.tumblr.value', [], 'socialfield'), 'placeholder' => 'http://', 'color' => '#35465c'], 'vimeo' => ['url' => 'http://www.vimeo.com/', 'title' => Translate::t('social.networks.vimeo.title', [], 'socialfield'), 'value' => Translate::t('social.networks.vimeo.value', [], 'socialfield'), 'placeholder' => 'http://www.vimeo.com/__username__', 'color' => '#1ab7ea'], 'vine' => ['url' => 'https://vine.co/', 'title' => Translate::t('social.networks.vine.title', [], 'socialfield'), 'value' => Translate::t('social.networks.vine.value', [], 'socialfield'), 'placeholder' => 'https://vine.co/__username__', 'color' => '#00b488'], 'vk' => ['url' => 'http://vk.com/', 'title' => Translate::t('social.networks.vk.title', [], 'socialfield'), 'value' => Translate::t('social.networks.vk.value', [], 'socialfield'), 'placeholder' => 'http://vk.com/__username__', 'color' => '#45668e'], 'weibo' => ['url' => 'http://www.weibo.com/', 'title' => Translate::t('social.networks.weibo.title', [], 'socialfield'), 'value' => Translate::t('social.networks.weibo.value', [], 'socialfield'), 'placeholder' => 'http://www.weibo.com/__username__', 'color' => '#e6162d'], 'youtube' => ['url' => 'http://www.youtube.com/', 'title' => Translate::t('social.networks.youtube.title', [], 'socialfield'), 'value' => Translate::t('social.networks.youtube.value', [], 'socialfield'), 'placeholder' => 'http://www.youtube.com/user/__username__', 'color' => '#cd201f'], 'rss' => ['url' => '', 'title' => Translate::t('social.networks.rss.title', [], 'socialfield'), 'value' => Translate::t('social.networks.rss.value', [], 'socialfield'), 'placeholder' => 'http://', 'color' => '#f26522']];
 }
 /**
  * Return all available background details.
  *
  * @return array $array Contains all background details
  *
  * @since 0.0.1
  */
 protected function getBackgroundDetails()
 {
     return ['position' => ['0 0' => Translate::t('background.details.position.left_top', [], 'backgroundfield'), '50% 0' => Translate::t('background.details.position.center_top', [], 'backgroundfield'), '100% 0' => Translate::t('background.details.position.right_top', [], 'backgroundfield'), '0 50%' => Translate::t('background.details.position.left_middle', [], 'backgroundfield'), '50% 50%' => Translate::t('background.details.position.center_middle', [], 'backgroundfield'), '100% 50%' => Translate::t('background.details.position.right_middle', [], 'backgroundfield'), '0 100%' => Translate::t('background.details.position.left_bottom', [], 'backgroundfield'), '50% 100%' => Translate::t('background.details.position.center_bottom', [], 'backgroundfield'), '100% 100%' => Translate::t('background.details.position.right_bottom', [], 'backgroundfield')], 'repeat' => ['no-repeat' => Translate::t('background.details.repeat.no_repeat', [], 'backgroundfield'), 'repeat-x' => Translate::t('background.details.repeat.repeat_x', [], 'backgroundfield'), 'repeat-y' => Translate::t('background.details.repeat.repeat_y', [], 'backgroundfield'), 'repeat' => Translate::t('background.details.repeat.repeat', [], 'backgroundfield')], 'size' => ['auto' => ['times', Translate::t('background.details.size.auto', [], 'backgroundfield')], 'cover' => ['arrows-h', Translate::t('background.details.size.cover', [], 'backgroundfield')], 'contain' => ['arrows', Translate::t('background.details.size.contain', [], 'backgroundfield')]]];
 }
示例#14
0
 /**
  * Return all available maps types.
  *
  * @return array $types
  */
 protected function getMapsTypes()
 {
     return ['ROADMAP' => Translate::t('map.types.roadmap', [], 'mapfield'), 'SATELLITE' => Translate::t('map.types.satellite', [], 'mapfield'), 'HYBRID' => Translate::t('map.types.hybrid', [], 'mapfield'), 'TERRAIN' => Translate::t('map.types.terrain', [], 'mapfield')];
 }
示例#15
0
 /**
  * Return all available modes.
  *
  * @return array $modes
  */
 protected function getModes()
 {
     return [['title' => Translate::t('code.modes.css', [], 'codefield'), 'mode' => ['text/css', 'css']], ['title' => Translate::t('code.modes.diff', [], 'codefield'), 'mode' => ['text/x-diff', 'x-diff', 'diff']], ['title' => Translate::t('code.modes.html', [], 'codefield'), 'mode' => ['text/html', 'html']], ['title' => Translate::t('code.modes.js', [], 'codefield'), 'mode' => ['text/javascript', 'javascript', 'js']], ['title' => Translate::t('code.modes.json', [], 'codefield'), 'mode' => ['application/json', 'json']], ['title' => Translate::t('code.modes.md', [], 'codefield'), 'mode' => ['text/x-markdown', 'markdown', 'md']], ['title' => Translate::t('code.modes.php', [], 'codefield'), 'mode' => ['application/x-httpd-php', 'x-httpd-php', 'php']], ['title' => Translate::t('code.modes.python', [], 'codefield'), 'mode' => ['text/x-python', 'x-python', 'python']], ['title' => Translate::t('code.modes.ruby', [], 'codefield'), 'mode' => ['text/x-ruby', 'x-ruby', 'ruby']], ['title' => Translate::t('code.modes.sh', [], 'codefield'), 'mode' => ['text/x-sh', 'x-sh', 'sh']], ['title' => Translate::t('code.modes.mysql', [], 'codefield'), 'mode' => ['text/x-mysql', 'x-mysql', 'mysql']], ['title' => Translate::t('code.modes.mariadb', [], 'codefield'), 'mode' => ['text/x-mariadb', 'x-mariadb', 'mariadb']], ['title' => Translate::t('code.modes.xml', [], 'codefield'), 'mode' => ['application/xml', 'xml']], ['title' => Translate::t('code.modes.yaml', [], 'codefield'), 'mode' => ['text/x-yaml', 'x-yaml', 'yaml']]];
 }