コード例 #1
0
ファイル: View.php プロジェクト: silversite/silverwp
 /**
  * Render view
  *
  * @param string $view_file path to file important: without extension
  * @param array  $data      data to load to theme
  *
  * @static
  * @access public
  */
 public static function render($view_file, array $data)
 {
     try {
         $view = View::getInstance()->load($view_file, $data);
         return $view;
     } catch (Exception $ex) {
         echo $ex->displayAdminNotice();
     }
 }
コード例 #2
0
ファイル: wpeditor.php プロジェクト: silversite/silverwp
 public function render($is_compact = false)
 {
     $this->_setup_data();
     $this->add_data('is_compact', $is_compact);
     $this->add_data('is_media_button', $this->is_media_button);
     $view_path = \SilverWp\FileSystem::getDirectory('ssvp_views');
     $content = \SilverWp\View::getInstance()->load($view_path . 'control/wpeditor', $this->get_data());
     return $content;
 }
コード例 #3
0
ファイル: AutoUpdate.php プロジェクト: silversite/silverwp
 /**
  * Display update information
  *
  * @access public
  */
 public function backendHtml()
 {
     global $current_screen;
     $parent_string = is_child_theme() ? 'Parent Theme (' . ucfirst($this->theme_name) . ')' : 'Theme';
     if (empty($this->user_name) || empty($this->api_key)) {
         echo Message::display(Translate::params('Once you have entered and saved your Username and API Key WordPress will check for
                     updates every 12 Hours and notify you here, if one is available <br/><br/> Your
                     current %s Version Number is <strong> %s </strong>', $parent_string, $this->version), 'updated');
         UpdateNotifier::getInstance();
     } else {
         if (($update = $this->isThemeUpdated()) !== false) {
             if ($current_screen->base != 'update-core') {
                 $target = network_admin_url('update-core.php?action=do-theme-upgrade');
                 $data = array('new_version' => $update['new_version'], 'target' => $target, 'parent' => $parent_string, 'version' => $this->version, 'theme_name' => $this->theme_name);
                 $view = View::render('Helper/auto-update', $data);
                 echo $view;
             }
         }
     }
 }
コード例 #4
0
 /**
  * Render widget view
  *
  * @param array $data data passed too view
  *
  * @param null|string $view_file
  *
  * @return string
  * @access protected
  */
 protected function render(array $data, $view_file = null)
 {
     if (\is_null($view_file)) {
         $view_file = $this->id_base;
     }
     try {
         $view_path = FileSystem::getDirectory('widgets_views');
         $view = View::getInstance()->load($view_path . $view_file, $data);
         echo $view;
     } catch (Exception $ex) {
         echo $ex->displayAdminNotice($ex->getMessage());
     }
 }
コード例 #5
0
 /**
  * Render short code view
  *
  * @param array       $data data passed too view
  *
  * @param null|string $view_file
  *
  * @return string
  * @access protected
  */
 protected function render(array $data, $view_file = null)
 {
     if (\is_null($view_file)) {
         $view_file = $this->tag_base;
     }
     try {
         $view_path = FileSystem::getDirectory('sc_templates');
         $view = View::getInstance()->load($view_path . $view_file, $data);
         return $view;
     } catch (Exception $ex) {
         echo $ex->catchException();
     }
 }
コード例 #6
0
ファイル: AjaxAbstract.php プロジェクト: silversite/silverwp
 /**
  * Ajax response in HTML format
  *
  * @param array  $data      data
  * @param string $view_file view file name
  *
  * @return string rendered view
  * @throws Exception
  */
 protected function responseHtml(array $data, $view_file = null)
 {
     if (\is_null($view_file)) {
         $view_file = $this->name;
     }
     try {
         $view_path = FileSystem::getDirectory('views');
         $view = View::getInstance()->load($view_path . 'ajax/' . $view_file, $data);
         //some servers don't display content with out echo
         echo $view;
         //fix display 0
         //return $view;
     } catch (Exception $ex) {
         echo $ex->displayAdminNotice($ex->getMessage());
     }
     exit;
 }
コード例 #7
0
ファイル: Wpml.php プロジェクト: silversite/silverwp
 /**
  * WPML lang switcher
  *
  * @static
  * @access public
  *
  * @param string $view_file
  *
  * @return string
  * @throws \SilverWp\Exception
  */
 public static function langSwitcher($view_file = 'lang-symbol-switcher')
 {
     if (function_exists('icl_get_languages')) {
         $args = 'skip_missing=1&orderby=code&order=ASC&link_empty_to=str';
         $languages = icl_get_languages($args);
         $view_path = FileSystem::getDirectory('views');
         $view = View::getInstance();
         $content = $view->load($view_path . $view_file, array('data' => $languages));
         return $content;
     }
     return false;
 }