Example #1
0
 /**
  * Catch exception and display error message
  *
  * @access public
  */
 public function catchException()
 {
     if (is_admin()) {
         echo $this->displayAdminNotice();
     } else {
         echo Message::alert($this->getMessage(), 'alert-error');
         if (WP_DEBUG) {
             \SilverWp\Debug::dumpPrint($this->getTrace());
         }
     }
 }
Example #2
0
 /**
  * Get video data
  *
  * @param integer $post_id
  * @param string  $key_name field key name
  *
  * @return array
  */
 public function getMedia($post_id, $key_name = 'video')
 {
     $file_data = array();
     $meta_box = $this->get($post_id, $key_name);
     $video_url = false;
     if (isset($meta_box['video_url']) && $meta_box['video_url']) {
         $video_url = $meta_box['video_url'];
     }
     if ($video_url) {
         try {
             $oEmbed = new Oembed($video_url);
             $file_data['provider_name'] = $oEmbed->provider_name;
             $file_data['file_url'] = $video_url;
             $file_data['thumbnail_url'] = $oEmbed->getThumbnailUrl();
         } catch (Exception $ex) {
             echo Message::alert($ex->getMessage(), 'alert-danger');
             if (WP_DEBUG) {
                 Debug::dumpPrint($ex->getTraceAsString(), 'Stack trace:');
                 Debug::dumpPrint($ex->getTrace(), 'Full stack:');
             }
         }
     }
     return $file_data;
 }
Example #3
0
 /**
  * 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;
             }
         }
     }
 }
Example #4
0
        /**
         * Import WPML settings
         *
         * @access public
         */
        public function import()
        {
            ?>
			<h1><?php 
            echo Translate::translate('WPML settings import');
            ?>
</h1>
			<?php 
            if (isset($_POST['wpml_settings_import']) || wp_verify_nonce($_POST['wpml_settings_import'], 'wpml_settings_import')) {
                if (isset($_FILES['wpml-settings']) && $_FILES['wpml-settings']['error'] == 0) {
                    $file = wp_handle_upload($_FILES['wpml-settings'], array('test_form' => false));
                    if (isset($file['url'])) {
                        $import = new ICLImportXML();
                        $result = $import->importSettings($file['url']);
                        if ($result == true && !is_wp_error($result)) {
                            echo Message::display(Translate::translate('Your WPML settings have been successfully imported!'));
                        } else {
                            echo Message::display(Translate::translate('Something went wrong. Either WPML is not installed or the wpml.xml could not be found or be opened!'));
                            if (is_wp_error($result)) {
                                echo Message::display($result->get_error_message());
                            }
                        }
                        unlink($file['file']);
                    }
                }
            }
            $this->importForm();
        }