Пример #1
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Build defaults data
     $template = array('id' => $content['id'], 'title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea Text'), 'default' => isset($content['default']) ? $content['default'] : '', 'description' => isset($content['description']) ? $content['description'] : '', 'options' => isset($content['options']) ? $content['options'] : array(), 'post' => $post, 'prefix' => $prefix, 'template' => $tpl);
     //Special variables
     $template['type'] = 'text';
     $template['min'] = '';
     $template['max'] = '';
     $template['step'] = '';
     //Attributes
     $template['attributes'] = 'size="30"';
     $template['attributes'] .= isset($content['placeholder']) ? ' placeholder="' . $content['placeholder'] . '"' : '';
     $template['attributes'] .= isset($content['maxlength']) ? ' maxlength="' . $content['maxlength'] . '"' : '';
     //Check type
     $type = isset($template['options']['type']) ? $template['options']['type'] : 'text';
     //Check options
     if ('number' == $type || 'range' == $type) {
         $template['type'] = $type;
         //Special variables
         $template['attributes'] .= isset($template['options']['min']) ? ' min="' . $template['options']['min'] . '"' : '';
         $template['attributes'] .= isset($template['options']['max']) ? ' max="' . $template['options']['max'] . '"' : '';
         $template['attributes'] .= isset($template['options']['step']) ? ' step="' . $template['options']['step'] . '"' : ' step="1"';
     }
     //Retrieve field value
     $template['val'] = $this->getFieldValue($details, $template['default'], $content['id']);
     //Get template
     return $this->renderField('fields/text.html.twig', $template);
 }
Пример #2
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build defaults data
     $template = array('title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea Heading'), 'level' => isset($content['level']) ? $content['level'] : 2, 'style' => isset($content['style']) ? ' style="' . $content['style'] . '"' : '');
     //Get template
     return $this->renderField('fields/heading.html.twig', $template);
 }
Пример #3
0
 /**
  * Get config values.
  *
  * @return array $configs Contains all config values
  *
  * @since 3.3.0
  */
 public static function getConfigs()
 {
     //Build defaults
     $defaults = array('status' => 0, 'server_host' => 'localhost', 'server_port' => '9200', 'index_name' => 'ttosearch', 'read_timeout' => 5, 'write_timeout' => 10, 'template' => 'no', 'posttypes' => array(), 'terms' => array(), 'scores' => array());
     //Return merge values
     return array_merge($defaults, TeaThemeOptions::getConfigs(self::getIndex() . '-data'));
 }
Пример #4
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build defaults data
     $template = array('title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea Include'), 'file' => isset($content['file']) ? $content['file'] : false);
     //Get template
     return $this->renderField('fields/includes.html.twig', $template);
 }
Пример #5
0
 /**
  * Build admin hooks.
  *
  * @since 3.3.0
  */
 public function commonHooks()
 {
     //Get configs
     $modules = TeaThemeOptions::getConfigs('modules');
     if (isset($modules['database']) && $modules['database']) {
         add_action('shutdown', array(&$this, 'hookCloseDbLink'), 99);
     }
     if (isset($modules['customlogin']) && $modules['customlogin']) {
         add_action('login_head', array(&$this, 'hookLoginPage'));
     }
 }
Пример #6
0
 /**
  * Constructor.
  *
  * @since 3.3.4
  */
 public function __construct()
 {
     //Initialize search
     $this->engine = new Engine();
     //Hooks
     if (TTO_IS_ADMIN) {
         add_filter('tto_template_footer_urls', function ($urls, $identifier) {
             return array_merge($urls, array('terms' => array('url' => admin_url('admin.php?page=' . $identifier . '&do=tto-action&from=footer&make=terms'), 'label' => TeaThemeOptions::__('terms'))));
         }, 10, 2);
     }
 }
Пример #7
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Build defaults data
     $template = array('id' => $content['id'], 'title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea Toggle'), 'description' => isset($content['description']) ? $content['description'] : '', 'default' => isset($content['default']) ? $content['default'] : false, 'enable' => isset($content['enable']) ? $content['enable'] : '', 'disable' => isset($content['disable']) ? $content['disable'] : '', 'post' => $post, 'prefix' => $prefix, 'template' => $tpl, 't_on' => TeaThemeOptions::__('On'), 't_off' => TeaThemeOptions::__('Off'));
     //Retrieve field value
     $template['val'] = $this->getFieldValue($details, $template['default'], $content['id']);
     //Get template
     return $this->renderField('fields/toggle.html.twig', $template);
 }
Пример #8
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Build defaults data
     $template = array('id' => $content['id'], 'title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea RTE'), 'default' => isset($content['default']) ? $content['default'] : '', 'description' => isset($content['description']) ? $content['description'] : '', 'settings' => array('teeny' => false, 'textarea_rows' => 8), 'post' => $post, 'prefix' => $prefix, 'template' => $tpl);
     //Retrieve field value
     $template['val'] = $this->getFieldValue($details, $template['default'], $content['id']);
     //Get template
     return $this->renderField('fields/rte.html.twig', $template);
 }
Пример #9
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Build defaults data
     $template = array('id' => $content['id'], 'title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea Radio'), 'description' => isset($content['description']) ? $content['description'] : '', 'default' => isset($content['default']) ? $content['default'] : '', 'mode' => isset($content['mode']) && 'image' == $content['mode'] ? 'image' : '', 'options' => isset($content['options']) ? $content['options'] : array(), 'post' => $post, 'prefix' => $prefix, 'template' => $tpl, 't_no_options' => TeaThemeOptions::__('Something went wrong in your parameters definition: 
             no options have been defined.'));
     //Retrieve field value
     $template['val'] = $this->getFieldValue($details, $template['default'], $content['id']);
     //Get template
     return $this->renderField('fields/radio.html.twig', $template);
 }
Пример #10
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Build defaults data
     $template = array('id' => $content['id'], 'title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea Link'), 'description' => isset($content['description']) ? $content['description'] : '', 'default' => isset($content['default']) ? $content['default'] : array(), 'expandable' => isset($content['expandable']) && is_bool($content['expandable']) ? $content['expandable'] : false, 'post' => $post, 'prefix' => $prefix, 'template' => $tpl, 't_add_link' => TeaThemeOptions::__('Add link'), 't_delete_all' => TeaThemeOptions::__('Delete all links'), 't_relationship' => TeaThemeOptions::__('Relationship'), 't_relationship_description' => TeaThemeOptions::__('You can set the <code>nofollow</code> value 
             to avoid bots following the linked document.'), 't_target' => TeaThemeOptions::__('Target'), 't_target_blank' => TeaThemeOptions::__('Opens the linked document in a new window or tab'), 't_target_self' => TeaThemeOptions::__('Opens the linked document in the same frame as it was clicked'), 't_target_parent' => TeaThemeOptions::__('Opens the linked document in the parent frame'), 't_target_top' => TeaThemeOptions::__('Opens the linked document in the full body of the window'), 't_title' => TeaThemeOptions::__('Title'), 't_website_address' => TeaThemeOptions::__('Web address'), 't_website_placeholder' => TeaThemeOptions::__('http://'), 't_goto' => TeaThemeOptions::__('Go to website'));
     //Retrieve field value
     $template['val'] = $this->getFieldValue($details, $template['default'], $content['id'], true);
     $template['val'] = isset($template['val']['url']) ? array($template['val']) : $template['val'];
     //Get template
     return $this->renderField('fields/link.html.twig', $template);
 }
Пример #11
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Build defaults data
     $template = array('id' => $content['id'], 'default' => isset($content['default']) ? $content['default'] : '', 'post' => $post, 'prefix' => $prefix, 'template' => $tpl);
     //Retrieve field value
     $template['val'] = $this->getFieldValue($details, $template['default'], $content['id']);
     //Get description
     $template['description'] = sprintf(TeaThemeOptions::__('Hidden field <code><b>%s</b></code> with value stored: <code>%s</code>'), $content['id'], $template['val']);
     //Get template
     return $this->renderField('fields/hidden.html.twig', $template);
 }
Пример #12
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Build defaults data
     $template = array('id' => $content['id'], 'title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea Multiselect'), 'description' => isset($content['description']) ? $content['description'] : '', 'default' => isset($content['default']) ? $content['default'] : array(), 'options' => isset($content['options']) ? $content['options'] : array(), 'post' => $post, 'prefix' => $prefix, 'template' => $tpl, 't_keyboard' => TeaThemeOptions::__('Press the <kbd>CTRL</kbd> or <kbd>CMD</kbd> button 
             to select more than one option.'), 't_no_options' => TeaThemeOptions::__('Something went wrong in your parameters definition: 
             no options have been defined.'));
     //Retrieve field value
     $template['val'] = $this->getFieldValue($details, $template['default'], $content['id'], true);
     //Get template
     return $this->renderField('fields/multiselect.html.twig', $template);
 }
Пример #13
0
 /**
  * Add a term to the theme options panel.
  *
  * @param array $configs Array containing all configurations
  * @param array $contents Contains all data
  *
  * @since 3.3.4
  */
 public function addTerm($configs = array())
 {
     //Check if we are in admin panel
     if (empty($configs) || !isset($configs['slug']) || empty($configs['slug'])) {
         return;
     }
     //Define the slug
     $configs['slug'] = TeaThemeOptions::getUrlize($configs['slug']);
     $slug = $configs['slug'];
     //Check if slug has already been registered
     if (isset($this->terms[$slug]) && !empty($this->terms[$slug])) {
         return;
     }
     //Define cpt configurations
     $this->terms[$slug] = $configs;
 }
Пример #14
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Build defaults data
     $template = array('id' => $content['id'], 'title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea Font'), 'default' => isset($content['default']) ? $content['default'] : '', 'description' => isset($content['description']) ? $content['description'] : '', 'fonts' => isset($content['fonts']) && $content['fonts'] ? true : false, 'options' => array(), 'styles' => '', 'css' => '', 'post' => $post, 'prefix' => $prefix, 'template' => $tpl);
     //Get options
     if ($template['fonts']) {
         $template['options'] = $this->getFontGoogle();
     }
     //Retrieve field value
     $template['val'] = $this->getFieldValue($details, $template['default'], $content['id']);
     //Get template
     return $this->renderField('fields/font.html.twig', $template);
 }
Пример #15
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.3.7
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Build defaults data
     $template = array('id' => $content['id'], 'title' => isset($content['title']) ? $content['title'] : TeaThemeOptions::__('Tea Upload'), 'default' => isset($content['default']) ? $content['default'] : array(), 'library' => isset($content['library']) ? $content['library'] : 'image', 'description' => isset($content['description']) ? $content['description'] : '', 'multiple' => isset($content['multiple']) && $content['multiple'] ? true : false, 'expand' => isset($content['expand']) && $content['expand'] ? true : false, 'alt' => isset($content['alt']) ? $content['alt'] : '', 'caption' => isset($content['caption']) ? $content['caption'] : '', 'can_upload' => $this->getCanUpload(), 'post' => $post, 'prefix' => $prefix, 'template' => $tpl, 't_add_media' => TeaThemeOptions::__('Add media'), 't_add_medias' => TeaThemeOptions::__('Add medias'), 't_delete_item' => TeaThemeOptions::__('Delete selection'), 't_delete_all' => TeaThemeOptions::__('Delete all medias'), 't_cannot_upload' => TeaThemeOptions::__('It seems you are not able to upload files.'), 't_sizes' => TeaThemeOptions::__('Available sizes'), 't_size_full' => TeaThemeOptions::__('Full size media'));
     //Fix bug with PDF
     $template['library'] = 'pdf' == $template['library'] ? 'application/pdf' : $template['library'];
     //Get titles
     $template['t_alt'] = !empty($template['alt']) ? $template['alt'] : TeaThemeOptions::__('Alternative text');
     $template['t_caption'] = !empty($template['caption']) ? $template['caption'] : TeaThemeOptions::__('Caption');
     //Retrieve field value
     $template['val'] = $this->getFieldValue($details, $template['default'], $content['id']);
     //Get template
     return $this->renderField('fields/upload.html.twig', $template);
 }
Пример #16
0
 /**
  * Display HTML component.
  *
  * @param array $content Contains all field data
  * @param array $details Contains all field options
  *
  * @since 3.0.0
  */
 public function prepareField($content, $details = array())
 {
     //Build details
     $post = isset($details['post']) ? $details['post'] : 0;
     $prefix = isset($details['prefix']) ? $details['prefix'] : '';
     $tpl = empty($prefix) ? 'pages' : 'terms';
     //Get indexed content count and status
     $count = TeaThemeOptions::getConfigs(SearchEngine::getIndex() . '-count', 0);
     $status = TeaThemeOptions::getConfigs(SearchEngine::getIndex() . '-status', 0);
     //Get page
     $page = $this->getSearchCurrentPage() . '&do=tto-action&make=create';
     //Get right page
     if (0 < $status) {
         $page = $this->getSearchCurrentPage() . '&do=tto-action&make=index';
     }
     //Build defaults data
     $template = array('count' => $count, 'page' => $page, 'status' => $status, 'post' => $post, 'prefix' => $prefix, 'template' => $tpl, 't_es_notify_n' => sprintf(TeaThemeOptions::__('<small>Check your configurations to properly use the Search Engine.</small>
                 <a href="%s" class="button button-primary">Create now your Search Index</a>'), $page), 't_es_notify_0' => sprintf(TeaThemeOptions::__('<small>Your parameters are well configured but your contents have not been indexed.</small>
                 <a href="%s" class="button button-primary">Let\'s do it!</a>'), $page), 't_es_notify_s' => sprintf(TeaThemeOptions::__('<small>Well done: <code>%d</code> posts have been indexed!</small>
                 <a href="%s" class="button button-main">Update contents!</a>'), $count, $page));
     //Get template
     return $this->renderField('fields/search.html.twig', $template);
 }
Пример #17
0
 /**
  * Build post types.
  *
  * @param array $pts Contains all post types.
  * @uses add_action()
  *
  * @since 3.3.6
  */
 public function setPostTypes($pts)
 {
     //Define post types
     $this->posttypes = $pts;
     //Add WP Hooks
     add_action('init', function () {
         //Check post types
         if (empty($this->posttypes)) {
             return;
         }
         //Get all registered post types
         $posttypes = array();
         //Register post type
         foreach ($this->posttypes as $pt) {
             $p = $this->registerPostType($pt);
             if (empty($p) || empty($p[0])) {
                 unset($this->posttypes[$pt['slug']]);
                 continue;
             }
             //Manage columns
             if (TTO_IS_ADMIN) {
                 add_filter('manage_edit-' . $p[1] . '_columns', array(&$this, 'hookColumns'), 10);
                 add_action('manage_' . $p[1] . '_posts_custom_column', array(&$this, 'hookCustomColumn'), 11, 2);
             }
             $this->posttypes[$pt['slug']] = $p[0];
         }
         //Update DB
         if (TTO_IS_ADMIN) {
             TeaThemeOptions::setConfigs(Engine::getIndex(), $this->posttypes);
         }
         //Permalink structures
         add_action('post_type_link', array(&$this, 'hookPermalinkMake'), 10, 3);
         if (TTO_IS_ADMIN) {
             //Display post type's custom fields
             add_action('admin_init', array(&$this, 'hookFieldsDisplay'));
             //Display settings in permalinks page
             add_action('admin_init', array(&$this, 'hookFieldsPermalink'));
             //Save post type's custom fields
             add_action('save_post', array(&$this, 'hookFieldsSave'));
         }
     }, 10, 1);
 }
Пример #18
0
 /**
  * Return all available modes.
  *
  * @return array $array Contains all modes
  *
  * @since 3.0.0
  */
 public function getModes()
 {
     return array(array('title' => TeaThemeOptions::__('CSS'), 'mode' => array('text/css', 'css')), array('title' => TeaThemeOptions::__('Diff'), 'mode' => array('text/x-diff', 'x-diff', 'diff')), array('title' => TeaThemeOptions::__('HTML Mixed'), 'mode' => array('text/html', 'html')), array('title' => TeaThemeOptions::__('JavaScript'), 'mode' => array('text/javascript', 'javascript', 'js')), array('title' => TeaThemeOptions::__('JSON'), 'mode' => array('application/json', 'json')), array('title' => TeaThemeOptions::__('Markdown'), 'mode' => array('text/x-markdown', 'markdown', 'md')), array('title' => TeaThemeOptions::__('PHP'), 'mode' => array('application/x-httpd-php', 'x-httpd-php', 'php')), array('title' => TeaThemeOptions::__('Python'), 'mode' => array('text/x-python', 'x-python', 'python')), array('title' => TeaThemeOptions::__('Ruby'), 'mode' => array('text/x-ruby', 'x-ruby', 'ruby')), array('title' => TeaThemeOptions::__('Shell'), 'mode' => array('text/x-sh', 'x-sh', 'sh')), array('title' => TeaThemeOptions::__('MySQL'), 'mode' => array('text/x-mysql', 'x-mysql', 'mysql')), array('title' => TeaThemeOptions::__('MariaDB'), 'mode' => array('text/x-mariadb', 'x-mariadb', 'mariadb')), array('title' => TeaThemeOptions::__('XML'), 'mode' => array('application/xml', 'xml')), array('title' => TeaThemeOptions::__('YAML'), 'mode' => array('text/x-yaml', 'x-yaml', 'yaml')));
 }
Пример #19
0
 /**
  * Hook building menus.
  *
  * @uses add_filter()
  * @uses add_menu_page()
  * @uses add_submenu_page()
  *
  * @since 3.0.0
  */
 public function hookAdminMenu()
 {
     //Admin panel
     if (!TTO_IS_ADMIN) {
         return;
     }
     //Check if no master page is defined
     if (empty($this->pages)) {
         TeaThemeOptions::notify('error', TeaThemeOptions::__('Something went wrong in your parameters
             definition: no master page found. You can simply do that by
             using the <code>TeaThemeOptions::addMenu</code> public function.'));
         return;
     }
     //Load assets action hook
     add_filter('admin_body_class', array(&$this, 'hookBodyClass'));
     //Reserved words
     $tocheck = array($this->identifier . '-settings');
     /**
      * Update reserved words.
      *
      * @param boolean $tocheck
      * @param string $identifier
      * @return boolean $tocheck
      *
      * @since 3.2.0
      */
     $tocheck = apply_filters('tto_menu_engine_check', $tocheck, $this->identifier);
     //Add submenu pages
     foreach ($this->pages as $page) {
         //Main page
         if ($this->identifier == $page['slug']) {
             //Update slug and capability
             $slug = $this->identifier;
             $capability = TTO_WP_CAP;
             //Add menu page
             add_menu_page($page['title'], $page['title'], $capability, $slug, array(&$this, 'tplContents'), ME_ICONSMALL, 80);
         } else {
             //Build slug and check it
             $slug = $page['slug'];
             $capability = in_array($page['slug'], $tocheck) ? TTO_WP_CAP_MAX : TTO_WP_CAP;
         }
         //Add subpage
         add_submenu_page($this->identifier, $page['title'], $page['name'], $capability, $slug, array(&$this, 'tplContents'));
     }
 }
Пример #20
0
 /**
  * Build admin hooks.
  *
  * @since 3.0.0
  */
 public function makeHooks()
 {
     //Admin panel
     if (TTO_IS_ADMIN) {
         return;
     }
     //Get configs
     $hooks = TeaThemeOptions::getConfigs('frontendhooks');
     //Auto-generated tags
     if (isset($hooks['generated']) && $hooks['generated']) {
         //Remove admin bar since v3.1
         add_filter('show_admin_bar', '__return_false');
         remove_action('init', 'wp_admin_bar_init');
         //Remove automatic feed links since WP v.3.x
         remove_theme_support('automatic-feed-links');
         //Remove feed links
         //<link rel="alternate" type="application/rss+xml" title="__SITE_NAME__ &raquo; Comments Feed" href="__SITE_URL__/comments/feed/" />
         remove_action('wp_head', 'feed_links', 2);
         //Remove extra feed links, such as categories, tags, etc.
         //<link rel="alternate" type="application/rss+xml" title="__SITE_NAME__ &raquo; Comments Feed" href="__SITE_URL__/category/__CAT__/feed/" />
         remove_action('wp_head', 'feed_links_extra', 3);
         //Remove WORDPRESS version.
         //<meta name="generator" content="WordPress __WP_VERSION__" />
         remove_action('wp_head', 'wp_generator');
         //Link to adjacent posts.
         //<link rel="prev" title="adjacent_posts_rel_link" href="__SITE_URL__" />
         remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
         //Link to blog index.
         //<link rel="index" title="__SITE_NAME__" href="__SITE_URL__" />
         remove_action('wp_head', 'index_rel_link');
         //Really Simple Discovery support.
         //<link rel="EditURI" type="application/rsd+xml" title="RSD" href="__SITE_URL__" />
         remove_action('wp_head', 'rsd_link');
         //Remove Shortlink Link Rel Hook
         remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
         //Windows Live Writter support.
         //<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="__SITE_URL__" />
         remove_action('wp_head', 'wlwmanifest_link');
         //Others
         remove_action('wp_head', 'parent_post_rel_link', 10, 0);
         remove_action('wp_head', 'start_post_rel_link', 10, 0);
         //Remove i18n styles
         remove_action('wp_head', 'wp_dlmp_l10n_style');
         //Shortcodes
         remove_filter('the_content', 'wpautop');
         remove_filter('the_content', 'wptexturize');
     }
     //Hooks
     if (isset($hooks['bodyclass']) && $hooks['bodyclass']) {
         add_filter('body_class', array(&$this, 'hookCleanBodyClass'), 10, 2);
     }
     if (isset($hooks['emojicons']) && $hooks['emojicons']) {
         add_action('init', array(&$this, 'hookDisableWPEmojicons'));
     }
     if (isset($hooks['version']) && $hooks['version']) {
         add_filter('the_generator', array(&$this, 'hookRemoveVersion'));
     }
     if (isset($hooks['shortcodeformatter']) && $hooks['shortcodeformatter']) {
         add_filter('the_content', array(&$this, 'hookShortcodeFormatter'), 99);
     }
 }
Пример #21
0
 /**
  * Build HTML component.
  *
  * @param array $post Contains all data such as Wordpress asks
  * @param array $args Contains all data such as Wordpress asks
  *
  * @return int|null
  *
  * @since 3.0.0
  */
 public function hookFieldBuild($post, $args)
 {
     //If autosave...
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return isset($post->ID) ? $post->ID : null;
     }
     //Get contents
     $content = isset($args['args']['contents']) ? $args['args']['contents'] : array();
     $field = isset($args['args']['field']) ? $args['args']['field'] : '';
     //Check if a type is defined
     if (empty($content) || empty($field) || !isset($args['args']['type'])) {
         TeaThemeOptions::notify('error', TeaThemeOptions::__('A field is missing because no type is defined.'));
         return null;
     }
     //Get values
     //$type = $args['args']['type'];
     //$id = isset($content['id']) ? $content['id'] : '';
     //Display field content
     $tpl = $field->prepareField($content, array('post' => $post));
     TeaThemeOptions::getRender($tpl['template'], $tpl['vars']);
     //Return post if it is asked
     return isset($post->ID) ? $post->ID : null;
 }
Пример #22
0
 /**
  * Search contents.
  *
  * @return array $elasticsearches Combine of all results, total and aggregations
  *
  * @since 1.5.0
  */
 public function searchContents()
 {
     //Return array
     $return = array('query' => array('search' => '', 'type' => '', 'paged' => 0, 'perpage' => 0), 'total' => 0, 'types' => array(), 'results' => array());
     //Check page
     if (!is_search()) {
         return $return;
     }
     //Get query vars
     $request = isset($_REQUEST) ? $_REQUEST : array();
     $results = array();
     $types = array();
     //Check request
     if (empty($request)) {
         return $return;
     }
     //Get Elasticsearch datas
     $index = $this->getIndex();
     //Check index
     if (null === $index || empty($index)) {
         return $return;
     }
     //Get search datas
     $search = isset($request['s']) ? str_replace('\\"', '"', $request['s']) : '';
     //Return everything
     if (empty($search)) {
         return $return;
     }
     //Get search datas
     $type = isset($request['type']) ? $request['type'] : '';
     $paged = isset($request['paged']) && !empty($request['paged']) ? $request['paged'] - 1 : 0;
     $perpage = isset($request['perpage']) ? $request['perpage'] : TeaThemeOptions::getOption('posts_per_page', 10);
     //Build query string
     $es_querystring = new QueryString();
     //'And' or 'Or' default: 'Or'
     $es_querystring->setDefaultOperator('OR');
     $es_querystring->setQuery($search);
     //Create the actual search object with some data.
     $es_query = new Query();
     $es_query->setQuery($es_querystring);
     //Define options
     $es_query->setFrom($paged);
     //Start
     $es_query->setLimit($perpage);
     //How many
     //Search!
     $es_resultset = $index->search($es_query);
     //Retrieve data
     $es_results = $es_resultset->getResults();
     //Check results
     if (null == $es_results || empty($es_results)) {
         $return['query']['search'] = str_replace(' ', '+', $search);
         return $return;
     }
     //Iterate to retrieve all IDs
     foreach ($es_results as $res) {
         $typ = $res->getType();
         //Save type
         $types[$typ] = $typ;
         //Save datas
         $results[$typ][] = array('id' => $res->getId(), 'score' => $res->getScore(), 'source' => $res->getSource());
     }
     //Get total
     $total = $es_resultset->getTotalHits();
     //Return everything
     $return = array('query' => array('search' => str_replace(' ', '+', $search), 'type' => $type, 'paged' => $paged, 'perpage' => $perpage), 'total' => $total, 'types' => $types, 'results' => $results);
     return $return;
 }
Пример #23
0
 /**
  * Return all available maps types.
  *
  * @return array $array Contains all maps types
  *
  * @since 3.0.0
  */
 public function getMapsTypes()
 {
     return array('ROADMAP' => TeaThemeOptions::__('Roadmap'), 'SATELLITE' => TeaThemeOptions::__('Satellite'), 'HYBRID' => TeaThemeOptions::__('Hybrid'), 'TERRAIN' => TeaThemeOptions::__('Terrain'));
 }
Пример #24
0
 /**
  * Build terms.
  *
  * @param array $terms Contains all terms.
  * @uses add_action()
  *
  * @since 3.3.6
  */
 public function setTerms($terms)
 {
     $this->terms = $terms;
     //Add WP Hooks
     add_action('init', function () {
         //Check post types
         if (empty($this->terms)) {
             return;
         }
         //Register post type
         foreach ($this->terms as $term) {
             $t = $this->registerTerm($term);
             if (empty($t) || empty($t[0])) {
                 unset($this->terms[$term['slug']]);
                 continue;
             }
             //Get all admin details
             if (TTO_IS_ADMIN) {
                 //Display custom fields
                 add_action($t[1] . '_edit_form_fields', array(&$this, 'hookFieldsDisplay'), 10, 1);
                 //add_action($t[1].'_add_form_fields', array(&$this, 'hookFieldsDisplay'), 10, 1);
                 //Save custom fields
                 add_action('created_' . $t[1], array(&$this, 'hookFieldsSave'), 10, 2);
                 add_action('edited_' . $t[1], array(&$this, 'hookFieldsSave'), 10, 2);
                 //Display custom columns
                 add_filter('manage_edit-' . $t[1] . '_columns', array(&$this, 'hookColumns'), 10);
                 add_filter('manage_' . $t[1] . '_custom_column', array(&$this, 'hookCustomColumn'), 11, 3);
                 //Special case: single choice on post edit page
                 if (isset($term['choice']) && 'single' === $term['choice']) {
                     //Define slug
                     $termslug = $t[1];
                     //Apply filter
                     add_filter('wp_terms_checklist_args', function ($args, $post_id) use($termslug) {
                         //Check taxonomy
                         if (isset($args['taxonomy']) && $termslug === $args['taxonomy']) {
                             $args['walker'] = new WalkerSingle();
                             $args['popular_cats'] = array();
                             $args['checked_ontop'] = false;
                         }
                         return $args;
                     }, 10, 2);
                 }
             }
             $this->terms[$term['slug']] = $t[0];
         }
         //Admin panel
         if (TTO_IS_ADMIN) {
             //Update DB
             TeaThemeOptions::setConfigs(Engine::getIndex(), $this->terms);
             //Flush all rewrite rules
             //flush_rewrite_rules();
         }
     }, 10, 1);
 }
Пример #25
0
 /**
  * Build header layout.
  *
  * @since 3.3.3
  */
 protected function tplVars()
 {
     //Admin panel
     if (!TTO_IS_ADMIN) {
         return;
     }
     //Prepare notices
     $notice = array();
     /**
      * Display notice screen.
      *
      * @param array $notice
      * @return array $notice
      *
      * @since 3.0.0
      */
     $notice = apply_filters('tto_template_notice', $notice);
     //Works on title
     $title = empty($this->currentPage) ? $this->pages[$this->identifier]['title'] : $this->pages[$this->currentPage]['title'];
     //Works on subtitle
     $subtitle = empty($this->currentSection) ? '' : $this->breadcrumb['currentSection'];
     //Build urls
     $urls = array('capabilities' => array('url' => current_user_can(TTO_WP_CAP_MAX) ? admin_url('admin.php?page=' . $this->identifier . '&do=tto-action&from=footer&make=capabilities') : '', 'label' => TeaThemeOptions::__('capabilities')));
     /**
      * Display footer usefull urls.
      *
      * @param array $urls
      * @param string $identifier
      * @return array $urls
      *
      * @since 3.2.0
      */
     $urls = apply_filters('tto_template_footer_urls', $urls, $this->identifier);
     //Add last urls
     $urls['version'] = array('url' => '', 'label' => sprintf('<code><small><b>v%s</b></small></code>', TTO_VERSION), 'target' => '_blank');
     //Partners
     $partners = array(array('url' => 'http://www.takeatea.com', 'label' => 'Take a tea', 'image' => TTO_URI . '/assets/img/partners/takeatea.png'), array('url' => 'http://www.basketsession.com/', 'label' => 'Éditions REVERSE Magazine', 'image' => TTO_URI . '/assets/img/partners/basketsession.png'));
     //Current page to check
     $current = empty($this->currentPage) ? $this->identifier : $this->currentPage;
     //Get all pages with link, icon and slug
     $template = array('identifier' => $this->identifier, 'version' => TTO_VERSION, 'currentPage' => empty($this->currentPage) ? $this->identifier : $this->currentPage, 'currentSection' => empty($this->currentSection) ? '' : $this->currentSection, 'title' => empty($title) ? TeaThemeOptions::__('Tea Theme Options') : $title, 'subtitle' => empty($subtitle) ? '' : $subtitle, 'description' => $this->pages[$current]['description'], 'submit' => $this->pages[$current]['submit'], 'sections' => isset($this->pages[$current]['sections']) ? $this->pages[$current]['sections'] : array(), 'breadcrumb' => $this->breadcrumb, 'notice' => $notice, 'urls' => $urls, 'partners' => $partners, 't_tto_title' => TeaThemeOptions::__('Tea T.O.'), 't_tto_search' => TeaThemeOptions::__('Search template'), 't_tto_update' => TeaThemeOptions::__('Update'), 't_tto_copyright' => TeaThemeOptions::__('Built with ♥ by <a href="https://github.com/crewstyle" target="_blank"><b>Achraf Chouk</b></a>'), 't_tto_quote' => TTO_QUOTE);
     //Get template
     return $template;
 }
Пример #26
0
 /**
  * Register $_POST and $_FILES into transients.
  *
  * @uses wp_handle_upload()
  * @param array $request Contains all data in $_REQUEST
  * @param array $files Contains all data in $_FILES
  *
  * @since 3.3.0
  */
 protected function updateSettings($request, $files)
 {
     //Admin panel
     if (!TTO_IS_ADMIN) {
         return;
     }
     //Check request
     if (empty($request)) {
         return;
     }
     //Set all options
     foreach ($request as $k => $v) {
         //Don't register this default value
         if (in_array($k, array('do', 'from', 'updated', 'submit'))) {
             continue;
         }
         //Check the key for special "NONE" value
         $v = 'NONE' == $v || empty($v) ? '' : $v;
         //Check settings
         if (preg_match('/^tto-configs-/', $k)) {
             $k = str_replace('tto-configs-', '', $k);
             TeaThemeOptions::setConfigs($k, $v);
         } else {
             /**
              * Fires for each data saved in DB.
              *
              * @param string $k Option's name
              * @param string $v Option's value
              *
              * @since 3.3.0
              */
             do_action('tto_action_update_settings', $k, $v);
             //Register option
             TeaThemeOptions::setOption($k, $v);
         }
     }
     //Check if files are attempting to be uploaded
     if (!empty($files)) {
         //Get required files
         require_once ABSPATH . 'wp-admin/includes/image.php';
         require_once ABSPATH . 'wp-admin/includes/file.php';
         require_once ABSPATH . 'wp-admin/includes/media.php';
         //Set all URL in transient
         foreach ($files as $k => $v) {
             //Don't do nothing if no file is defined
             if (empty($v['tmp_name'])) {
                 continue;
             }
             //Do the magic
             $file = wp_handle_upload($v, array('test_form' => false));
             //Register option and transient
             TeaThemeOptions::setOption($k, $file['url']);
         }
     }
     //Notify
     TeaThemeOptions::notify('updated', TeaThemeOptions::__('The Tea Theme Options is updated.'));
 }
Пример #27
0
 /**
  * Return all available background details.
  *
  * @return array $array Contains all background details
  *
  * @since 3.0.0
  */
 public function getBackgroundDetails()
 {
     return array('position' => array('0 0' => TeaThemeOptions::__('Left top'), '50% 0' => TeaThemeOptions::__('Center top'), '100% 0' => TeaThemeOptions::__('Right top'), '0 50%' => TeaThemeOptions::__('Left middle'), '50% 50%' => TeaThemeOptions::__('Center middle'), '100% 50%' => TeaThemeOptions::__('Right middle'), '0 100%' => TeaThemeOptions::__('Left bottom'), '50% 100%' => TeaThemeOptions::__('Center bottom'), '100% 100%' => TeaThemeOptions::__('Right bottom')), 'repeat' => array('no-repeat' => TeaThemeOptions::__('Displayed only once.'), 'repeat-x' => TeaThemeOptions::__('Repeated horizontally only.'), 'repeat-y' => TeaThemeOptions::__('Repeated vertically only.'), 'repeat' => TeaThemeOptions::__('Repeated all the way.')), 'size' => array('auto' => array('times', TeaThemeOptions::__('Normal state')), 'cover' => array('arrows-h', TeaThemeOptions::__('As large as possible')), 'contain' => array('arrows', TeaThemeOptions::__('Width and height can fit inside the content area'))));
 }
Пример #28
0
 /**
  * Update rewrite rules options.
  *
  * @param array $args Define if the TTO has to make a redirect
  *
  * @since 3.3.0
  */
 static function wp_enqueue_media_tto($args = array())
 {
     //Admin panel
     if (!TTO_IS_ADMIN) {
         return;
     }
     //Enqueue me just once per page, please.
     if (did_action('wp_enqueue_media_tto') || did_action('wp_enqueue_media')) {
         return;
     }
     global $content_width, $wpdb, $wp_locale;
     $defaults = array('post' => null);
     $args = wp_parse_args($args, $defaults);
     //We're going to pass the old thickbox media tabs to `media_upload_tabs`
     //to ensure plugins will work. We will then unset those tabs.
     $tabs = array('type' => '', 'type_url' => '', 'gallery' => '', 'library' => '');
     /** This filter is documented in wp-admin/includes/media.php */
     $tabs = apply_filters('media_upload_tabs', $tabs);
     unset($tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library']);
     $props = array('link' => get_option('image_default_link_type'), 'align' => get_option('image_default_align'), 'size' => get_option('image_default_size'));
     $exts = array_merge(wp_get_audio_extensions(), wp_get_video_extensions());
     $mimes = get_allowed_mime_types();
     $ext_mimes = array();
     foreach ($exts as $ext) {
         foreach ($mimes as $ext_preg => $mime_match) {
             if (preg_match('#' . $ext . '#i', $ext_preg)) {
                 $ext_mimes[$ext] = $mime_match;
                 break;
             }
         }
     }
     if (false === ($has_audio = get_transient('has_audio'))) {
         $has_audio = (bool) $wpdb->get_var("\n                    SELECT ID\n                    FROM {$wpdb->posts}\n                    WHERE post_type = 'attachment'\n                    AND post_mime_type LIKE 'audio%'\n                    LIMIT 1\n                ");
         set_transient('has_audio', $has_audio);
     }
     if (false === ($has_video = get_transient('has_video'))) {
         $has_video = (bool) $wpdb->get_var("\n                    SELECT ID\n                    FROM {$wpdb->posts}\n                    WHERE post_type = 'attachment'\n                    AND post_mime_type LIKE 'video%'\n                    LIMIT 1\n                ");
         set_transient('has_video', $has_video);
     }
     $months = $wpdb->get_results($wpdb->prepare("\n            SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month\n            FROM {$wpdb->posts}\n            WHERE post_type = %s\n            ORDER BY post_date DESC\n        ", 'attachment'));
     foreach ($months as $month_year) {
         $month_year->text = sprintf(TeaThemeOptions::__('%1$s %2$d'), $wp_locale->get_month($month_year->month), $month_year->year);
     }
     $settings = array('tabs' => $tabs, 'tabUrl' => add_query_arg(array('chromeless' => true), admin_url('media-upload.php')), 'mimeTypes' => wp_list_pluck(get_post_mime_types(), 0), 'captions' => !apply_filters('disable_captions', ''), 'nonce' => array('sendToEditor' => wp_create_nonce('media-send-to-editor')), 'post' => array('id' => 0), 'defaultProps' => $props, 'attachmentCounts' => array('audio' => $has_audio ? 1 : 0, 'video' => $has_video ? 1 : 0), 'embedExts' => $exts, 'embedMimes' => $ext_mimes, 'contentWidth' => $content_width, 'months' => $months, 'mediaTrash' => MEDIA_TRASH ? 1 : 0);
     $post = null;
     if (isset($args['post'])) {
         $post = get_post($args['post']);
         $settings['post'] = array('id' => $post->ID, 'nonce' => wp_create_nonce('update-post_' . $post->ID));
         $thumbnail_support = current_theme_supports('post-thumbnails', $post->post_type) && post_type_supports($post->post_type, 'thumbnail');
         if (!$thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type) {
             if (wp_attachment_is('audio', $post)) {
                 $thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio');
             } elseif (wp_attachment_is('video', $post)) {
                 $thumbnail_support = post_type_supports('attachment:video', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:video');
             }
         }
         if ($thumbnail_support) {
             $featured_image_id = get_post_meta($post->ID, '_thumbnail_id', true);
             $settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
         }
     }
     $hier = $post && is_post_type_hierarchical($post->post_type);
     $strings = array('url' => TeaThemeOptions::__('URL'), 'addMedia' => TeaThemeOptions::__('Add Media'), 'search' => TeaThemeOptions::__('Search'), 'select' => TeaThemeOptions::__('Select'), 'cancel' => TeaThemeOptions::__('Cancel'), 'update' => TeaThemeOptions::__('Update'), 'replace' => TeaThemeOptions::__('Replace'), 'remove' => TeaThemeOptions::__('Remove'), 'back' => TeaThemeOptions::__('Back'), 'selected' => TeaThemeOptions::__('%d selected'), 'dragInfo' => TeaThemeOptions::__('Drag and drop to reorder media files.'), 'uploadFilesTitle' => TeaThemeOptions::__('Upload Files'), 'uploadImagesTitle' => TeaThemeOptions::__('Upload Images'), 'mediaLibraryTitle' => TeaThemeOptions::__('Media Library'), 'insertMediaTitle' => TeaThemeOptions::__('Insert Media'), 'createNewGallery' => TeaThemeOptions::__('Create a new gallery'), 'createNewPlaylist' => TeaThemeOptions::__('Create a new playlist'), 'createNewVideoPlaylist' => TeaThemeOptions::__('Create a new video playlist'), 'returnToLibrary' => TeaThemeOptions::__('&#8592; Return to library'), 'allMediaItems' => TeaThemeOptions::__('All media items'), 'allDates' => TeaThemeOptions::__('All dates'), 'noItemsFound' => TeaThemeOptions::__('No items found.'), 'insertIntoPost' => $hier ? TeaThemeOptions::__('Insert into page') : TeaThemeOptions::__('Insert into post'), 'unattached' => TeaThemeOptions::__('Unattached'), 'trash' => _x('Trash', 'noun'), 'uploadedToThisPost' => $hier ? TeaThemeOptions::__('Uploaded to this page') : TeaThemeOptions::__('Uploaded to this post'), 'warnDelete' => TeaThemeOptions::__("You are about to permanently delete this item.\n                \n  'Cancel' to stop, 'OK' to delete."), 'warnBulkDelete' => TeaThemeOptions::__("You are about to permanently delete these items.\n                \n  'Cancel' to stop, 'OK' to delete."), 'warnBulkTrash' => TeaThemeOptions::__("You are about to trash these items.\n                \n  'Cancel' to stop, 'OK' to delete."), 'bulkSelect' => TeaThemeOptions::__('Bulk Select'), 'cancelSelection' => TeaThemeOptions::__('Cancel Selection'), 'trashSelected' => TeaThemeOptions::__('Trash Selected'), 'untrashSelected' => TeaThemeOptions::__('Untrash Selected'), 'deleteSelected' => TeaThemeOptions::__('Delete Selected'), 'deletePermanently' => TeaThemeOptions::__('Delete Permanently'), 'apply' => TeaThemeOptions::__('Apply'), 'filterByDate' => TeaThemeOptions::__('Filter by date'), 'filterByType' => TeaThemeOptions::__('Filter by type'), 'searchMediaLabel' => TeaThemeOptions::__('Search Media'), 'noMedia' => TeaThemeOptions::__('No media attachments found.'), 'attachmentDetails' => TeaThemeOptions::__('Attachment Details'), 'insertFromUrlTitle' => TeaThemeOptions::__('Insert from URL'), 'setFeaturedImageTitle' => TeaThemeOptions::__('Set Featured Image'), 'setFeaturedImage' => TeaThemeOptions::__('Set featured image'), 'createGalleryTitle' => TeaThemeOptions::__('Create Gallery'), 'editGalleryTitle' => TeaThemeOptions::__('Edit Gallery'), 'cancelGalleryTitle' => TeaThemeOptions::__('&#8592; Cancel Gallery'), 'insertGallery' => TeaThemeOptions::__('Insert gallery'), 'updateGallery' => TeaThemeOptions::__('Update gallery'), 'addToGallery' => TeaThemeOptions::__('Add to gallery'), 'addToGalleryTitle' => TeaThemeOptions::__('Add to Gallery'), 'reverseOrder' => TeaThemeOptions::__('Reverse order'), 'imageDetailsTitle' => TeaThemeOptions::__('Image Details'), 'imageReplaceTitle' => TeaThemeOptions::__('Replace Image'), 'imageDetailsCancel' => TeaThemeOptions::__('Cancel Edit'), 'editImage' => TeaThemeOptions::__('Edit Image'), 'chooseImage' => TeaThemeOptions::__('Choose Image'), 'selectAndCrop' => TeaThemeOptions::__('Select and Crop'), 'skipCropping' => TeaThemeOptions::__('Skip Cropping'), 'cropImage' => TeaThemeOptions::__('Crop Image'), 'cropYourImage' => TeaThemeOptions::__('Crop your image'), 'cropping' => TeaThemeOptions::__('Cropping&hellip;'), 'suggestedDimensions' => TeaThemeOptions::__('Suggested image dimensions:'), 'cropError' => TeaThemeOptions::__('There has been an error cropping your image.'), 'audioDetailsTitle' => TeaThemeOptions::__('Audio Details'), 'audioReplaceTitle' => TeaThemeOptions::__('Replace Audio'), 'audioAddSourceTitle' => TeaThemeOptions::__('Add Audio Source'), 'audioDetailsCancel' => TeaThemeOptions::__('Cancel Edit'), 'videoDetailsTitle' => TeaThemeOptions::__('Video Details'), 'videoReplaceTitle' => TeaThemeOptions::__('Replace Video'), 'videoAddSourceTitle' => TeaThemeOptions::__('Add Video Source'), 'videoDetailsCancel' => TeaThemeOptions::__('Cancel Edit'), 'videoSelectPosterImageTitle' => TeaThemeOptions::__('Select Poster Image'), 'videoAddTrackTitle' => TeaThemeOptions::__('Add Subtitles'), 'playlistDragInfo' => TeaThemeOptions::__('Drag and drop to reorder tracks.'), 'createPlaylistTitle' => TeaThemeOptions::__('Create Audio Playlist'), 'editPlaylistTitle' => TeaThemeOptions::__('Edit Audio Playlist'), 'cancelPlaylistTitle' => TeaThemeOptions::__('&#8592; Cancel Audio Playlist'), 'insertPlaylist' => TeaThemeOptions::__('Insert audio playlist'), 'updatePlaylist' => TeaThemeOptions::__('Update audio playlist'), 'addToPlaylist' => TeaThemeOptions::__('Add to audio playlist'), 'addToPlaylistTitle' => TeaThemeOptions::__('Add to Audio Playlist'), 'videoPlaylistDragInfo' => TeaThemeOptions::__('Drag and drop to reorder videos.'), 'createVideoPlaylistTitle' => TeaThemeOptions::__('Create Video Playlist'), 'editVideoPlaylistTitle' => TeaThemeOptions::__('Edit Video Playlist'), 'cancelVideoPlaylistTitle' => TeaThemeOptions::__('&#8592; Cancel Video Playlist'), 'insertVideoPlaylist' => TeaThemeOptions::__('Insert video playlist'), 'updateVideoPlaylist' => TeaThemeOptions::__('Update video playlist'), 'addToVideoPlaylist' => TeaThemeOptions::__('Add to video playlist'), 'addToVideoPlaylistTitle' => TeaThemeOptions::__('Add to Video Playlist'));
     /**
      * Filter the media view settings.
      *
      * @since WordPress 3.5.0
      *
      * @param array   $settings List of media view settings.
      * @param WP_Post $post     Post object.
      */
     $settings = apply_filters('media_view_settings', $settings, $post);
     /**
      * Filter the media view strings.
      *
      * @since WordPress 3.5.0
      *
      * @param array   $strings List of media view strings.
      * @param WP_Post $post    Post object.
      */
     $strings = apply_filters('media_view_strings', $strings, $post);
     $strings['settings'] = $settings;
     //Ensure we enqueue media-editor first, that way media-views is
     //registered internally before we try to localize it. see #24724.
     wp_enqueue_script('media-editor');
     wp_localize_script('media-views', '_wpMediaViewsL10n', $strings);
     wp_enqueue_script('media-audiovideo');
     wp_enqueue_style('media-views');
     if (TTO_IS_ADMIN) {
         wp_enqueue_script('mce-view');
         wp_enqueue_script('image-edit');
     }
     wp_enqueue_style('imgareaselect');
     wp_plupload_default_settings();
     require_once ABSPATH . WPINC . '/media-template.php';
     add_action('admin_footer', 'wp_print_media_templates');
     add_action('wp_footer', 'wp_print_media_templates');
     add_action('customize_controls_print_footer_scripts', 'wp_print_media_templates');
     /**
      * Fires at the conclusion of wp_enqueue_media_tto().
      *
      * @since WordPress 3.5.0
      */
     do_action('wp_enqueue_media_tto');
 }
Пример #29
0
 /**
  * Hook on search.
  *
  * @since 3.0.0
  */
 public function hookSearchTemplate()
 {
     //Check page
     if (TTO_IS_ADMIN || !is_search() || !$this->template) {
         return;
     }
     //Display template
     TeaThemeOptions::getRender('fields/search_results.html.twig', array('results' => $this->getEngine()->searchContents(), 't_see_all' => TeaThemeOptions::__('See all'), 't_read_more' => TeaThemeOptions::__('Read more'), 't_date' => TeaThemeOptions::__('By <a href="%s" itemprop="author">%s</a> on 
             <time datetime="%s" itemprop="datePublished">%s</time>'), 't_apologies' => TeaThemeOptions::__('Apologies, but no results were found for the requested archive. 
             Perhaps searching will help find a related post.')));
     exit;
 }
Пример #30
0
 /**
  * Return all available Social networks.
  *
  * @return array $array Contains all Social networks
  *
  * @since 3.3.0
  */
 public function getSocialNetworks()
 {
     return array('twitter' => array('url' => TeaThemeOptions::__('http://www.twitter.com/'), 'title' => TeaThemeOptions::__('Twitter'), 'value' => TeaThemeOptions::__('Follow me on Twitter'), 'placeholder' => TeaThemeOptions::__('http://www.twitter.com/__username__'), 'color' => '#55acee'), 'facebook' => array('url' => TeaThemeOptions::__('http://www.facebook.com/'), 'title' => TeaThemeOptions::__('Facebook'), 'value' => TeaThemeOptions::__('Follow me on Facebook'), 'placeholder' => TeaThemeOptions::__('http://www.facebook.com/__username__'), 'color' => '#3b5998'), 'instagram' => array('url' => TeaThemeOptions::__('http://www.instagram.com/'), 'title' => TeaThemeOptions::__('Instagram'), 'value' => TeaThemeOptions::__('Follow me on Instagram'), 'placeholder' => TeaThemeOptions::__('http://www.instagram.com/__username__'), 'color' => '#3f729b'), 'google-plus' => array('url' => TeaThemeOptions::__('http://plus.google.com/'), 'title' => TeaThemeOptions::__('Google+'), 'value' => TeaThemeOptions::__('Follow me on Google+'), 'placeholder' => TeaThemeOptions::__('http://plus.google.com/__username__'), 'color' => '#dc4e41'), 'linkedin' => array('url' => TeaThemeOptions::__('http://www.linkedin.com/'), 'title' => TeaThemeOptions::__('LinkedIn'), 'value' => TeaThemeOptions::__('Follow me on LinkedIn'), 'placeholder' => TeaThemeOptions::__('http://www.linkedin.com/in/__username__'), 'color' => '#0077b5'), '500px' => array('url' => TeaThemeOptions::__('https://500px.com/'), 'title' => TeaThemeOptions::__('500px'), 'value' => TeaThemeOptions::__('See my portfolio on 500px'), 'placeholder' => TeaThemeOptions::__('https://500px.com/__username__'), 'color' => '#0099e5'), 'behance' => array('url' => TeaThemeOptions::__('http://www.behance.com/'), 'title' => TeaThemeOptions::__('Behance'), 'value' => TeaThemeOptions::__('See my portfolio on Behance'), 'placeholder' => TeaThemeOptions::__('http://www.behance.com/__username__'), 'color' => '#1769ff'), 'bitbucket' => array('url' => TeaThemeOptions::__('https://bitbucket.org/'), 'title' => TeaThemeOptions::__('Bitbucket'), 'value' => TeaThemeOptions::__('Tip me on Bitbucket'), 'placeholder' => TeaThemeOptions::__('https://bitbucket.org/__username__'), 'color' => '#205081'), 'codepen' => array('url' => TeaThemeOptions::__('http://codepen.io/'), 'title' => TeaThemeOptions::__('CodePen'), 'value' => TeaThemeOptions::__('Follow me on Codepen.io'), 'placeholder' => TeaThemeOptions::__('http://codepen.io/__username__'), 'color' => '#000000'), 'delicious' => array('url' => TeaThemeOptions::__('https://delicious.com/'), 'title' => TeaThemeOptions::__('Delicious'), 'value' => TeaThemeOptions::__('Follow me on Delicious'), 'placeholder' => TeaThemeOptions::__('https://delicious.com/__username__'), 'color' => '#3399ff'), 'deviantart' => array('url' => TeaThemeOptions::__('http://www.deviantart.com/'), 'title' => TeaThemeOptions::__('DeviantArt'), 'value' => TeaThemeOptions::__('Follow me on Deviantart'), 'placeholder' => TeaThemeOptions::__('http://__username__.deviantart.com/'), 'color' => '#05cc47'), 'dribbble' => array('url' => TeaThemeOptions::__('http://dribbble.com/'), 'title' => TeaThemeOptions::__('Dribbble'), 'value' => TeaThemeOptions::__('Follow me on Dribbble'), 'placeholder' => TeaThemeOptions::__('http://dribbble.com/__username__'), 'color' => '#ea4c89'), 'flickr' => array('url' => TeaThemeOptions::__('http://www.flickr.com/'), 'title' => TeaThemeOptions::__('FlickR'), 'value' => TeaThemeOptions::__('Follow me on Flickr'), 'placeholder' => TeaThemeOptions::__('http://www.flickr.com/photos/__username__'), 'color' => '#0063dc'), 'foursquare' => array('url' => TeaThemeOptions::__('https://www.foursquare.com/'), 'title' => TeaThemeOptions::__('4square'), 'value' => TeaThemeOptions::__('See me on Foursquare'), 'placeholder' => TeaThemeOptions::__('https://www.foursquare.com/__username__'), 'color' => '#f94877'), 'gittip' => array('url' => TeaThemeOptions::__('https://www.gittip.com/'), 'title' => TeaThemeOptions::__('Gittip'), 'value' => TeaThemeOptions::__('Follow me on Gittip'), 'placeholder' => TeaThemeOptions::__('https://www.gittip.com/__username__'), 'color' => '#663300'), 'github' => array('url' => TeaThemeOptions::__('https://github.com/'), 'title' => TeaThemeOptions::__('Github'), 'value' => TeaThemeOptions::__('Follow me on Github'), 'placeholder' => TeaThemeOptions::__('https://github.com/__username__'), 'color' => '#333333'), 'gratipay' => array('url' => TeaThemeOptions::__('https://gratipay.com/'), 'title' => TeaThemeOptions::__('Gratipay'), 'value' => TeaThemeOptions::__('Tip me Gratipay'), 'placeholder' => TeaThemeOptions::__('https://gratipay.com/__username__'), 'color' => '#6c2e00'), 'lastfm' => array('url' => TeaThemeOptions::__('http://www.lastfm.fr/'), 'title' => TeaThemeOptions::__('Last FM'), 'value' => TeaThemeOptions::__('Follow me on LastFM'), 'placeholder' => TeaThemeOptions::__('http://www.lastfm.fr/user/__username__'), 'color' => '#d51007'), 'pinterest' => array('url' => TeaThemeOptions::__('http://pinterest.com/'), 'title' => TeaThemeOptions::__('Pinterest'), 'value' => TeaThemeOptions::__('Follow me on Pinterest'), 'placeholder' => TeaThemeOptions::__('http://pinterest.com/__username__'), 'color' => '#bd081c'), 'reddit' => array('url' => TeaThemeOptions::__('http://www.reddit.com/'), 'title' => TeaThemeOptions::__('Reddit'), 'value' => TeaThemeOptions::__('Follow me on Reddit'), 'placeholder' => TeaThemeOptions::__('http://www.reddit.com/user/__username__'), 'color' => '#ff4500'), 'skype' => array('url' => TeaThemeOptions::__('http://www.skype.com/'), 'title' => TeaThemeOptions::__('Skype'), 'value' => TeaThemeOptions::__('Connect us on Skype'), 'placeholder' => TeaThemeOptions::__('__username__'), 'color' => '#00aff0'), 'soundcloud' => array('url' => TeaThemeOptions::__('https://soundcloud.com/'), 'title' => TeaThemeOptions::__('SoundCloud'), 'value' => TeaThemeOptions::__('Follow me on Soundcloud'), 'placeholder' => TeaThemeOptions::__('https://soundcloud.com/__username__'), 'color' => '#ff3300'), 'stumbleupon' => array('url' => TeaThemeOptions::__('http://www.stumbleupon.com/'), 'title' => TeaThemeOptions::__('Stumbleupon'), 'value' => TeaThemeOptions::__('Follow me on Stumbleupon'), 'placeholder' => TeaThemeOptions::__('http://www.stumbleupon.com/stumbler/__username__'), 'color' => '#eb4924'), 'tumblr' => array('url' => TeaThemeOptions::__('https://www.tumblr.com/'), 'title' => TeaThemeOptions::__('Tumblr'), 'value' => TeaThemeOptions::__('Follow me on Tumblr'), 'placeholder' => TeaThemeOptions::__('http://'), 'color' => '#35465c'), 'vimeo' => array('url' => TeaThemeOptions::__('http://www.vimeo.com/'), 'title' => TeaThemeOptions::__('Vimeo'), 'value' => TeaThemeOptions::__('Follow me on Vimeo'), 'placeholder' => TeaThemeOptions::__('http://www.vimeo.com/__username__'), 'color' => '#1ab7ea'), 'vine' => array('url' => TeaThemeOptions::__('https://vine.co/'), 'title' => TeaThemeOptions::__('Vine'), 'value' => TeaThemeOptions::__('Follow me on Vine.co'), 'placeholder' => TeaThemeOptions::__('https://vine.co/__username__'), 'color' => '#00b488'), 'vk' => array('url' => TeaThemeOptions::__('http://vk.com/'), 'title' => TeaThemeOptions::__('VKontakte'), 'value' => TeaThemeOptions::__('Follow me on VK.com'), 'placeholder' => TeaThemeOptions::__('http://vk.com/__username__'), 'color' => '#45668e'), 'weibo' => array('url' => TeaThemeOptions::__('http://www.weibo.com/'), 'title' => TeaThemeOptions::__('Weibo'), 'value' => TeaThemeOptions::__('Follow me on Weibo'), 'placeholder' => TeaThemeOptions::__('http://www.weibo.com/__username__'), 'color' => '#e6162d'), 'youtube' => array('url' => TeaThemeOptions::__('http://www.youtube.com/'), 'title' => TeaThemeOptions::__('Youtube'), 'value' => TeaThemeOptions::__('Follow me on Youtube'), 'placeholder' => TeaThemeOptions::__('http://www.youtube.com/user/__username__'), 'color' => '#cd201f'), 'rss' => array('url' => '', 'title' => TeaThemeOptions::__('RSS'), 'value' => TeaThemeOptions::__('Subscribe to my RSS feed'), 'placeholder' => TeaThemeOptions::__('__rssfeed__'), 'color' => '#f26522'));
 }