/**
  * Find html template for shortcode output.
  */
 protected function findShortcodeTemplate()
 {
     // Check template path in shortcode's mapping settings
     if (!empty($this->settings['html_template']) && is_file($this->settings('html_template'))) {
         return $this->setTemplate($this->settings['html_template']);
     }
     // Check template in theme directory
     $user_template = WPBakeryVisualComposer::getUserTemplate($this->getFilename() . '.php');
     if (is_file($user_template)) {
         return $this->setTemplate($user_template);
     }
     // Check default place
     $default_dir = $this->getVcTableDefaultDir();
     if (is_file($default_dir . $this->getFilename() . '.php')) {
         return $this->setTemplate($default_dir . $this->getFilename() . '.php');
     }
 }
 public function getTemplatePath($key)
 {
     $template = isset($this->templates[$key]) ? $this->templates[$key] : false;
     if (!$template) {
         return false;
     }
     // Check template path in shortcode's mapping settings
     if (is_array($template) && isset($template['path']) && !empty($template['path'])) {
         return $template['path'];
     }
     // Check template in theme directory
     $user_template = WPBakeryVisualComposer::getUserTemplate($this->getFileName($key));
     if (is_file($user_template)) {
         return $this->setTemplate($key, $user_template);
     }
     // Check default place
     $default_dir = WPBakeryVisualComposer::defaultTemplatesDIR();
     if (is_file($default_dir . $this->getFilename($key))) {
         return $this->setTemplate($key, $default_dir . $this->getFileName($key));
     }
 }
Exemple #3
0
 protected function findBlockTemplate()
 {
     $template_path = $this->block_template_dir_name . '/' . $this->block_template_filename;
     // Check template path in shortcode's mapping settings
     if (!empty($this->settings['html_template']) && is_file($this->settings('html_template') . $template_path)) {
         return $this->settings['html_template'] . $template_path;
     }
     // Check template in theme directory
     $user_template = WPBakeryVisualComposer::getUserTemplate($template_path);
     if (is_file($user_template)) {
         return $user_template;
     }
     // Check default place
     $default_dir = WPBakeryVisualComposer::defaultTemplatesDIR();
     if (is_file($default_dir . $template_path)) {
         return $default_dir . $template_path;
     }
     return $template_path;
 }
Exemple #4
0
 protected function getPartial($partial)
 {
     // Check template path in shortcode's mapping settings
     if (isset($this->partial_paths[$partial])) {
         return $this->partial_paths[$partial];
     }
     // Check template in theme directory
     $user_template = WPBakeryVisualComposer::getUserTemplate($this->getPartialFilename($partial));
     if (is_file($user_template)) {
         return $this->setPartialTemplate($partial, $user_template);
     }
     // Check default place
     $default_dir = WPBakeryVisualComposer::defaultTemplatesDIR();
     $default_dir . $this->getPartialFilename($partial);
     if (is_file($default_dir . $this->getPartialFilename($partial))) {
         return $this->setPartialTemplate($partial, $default_dir . $this->getPartialFilename($partial));
     }
 }