Example #1
0
 public function createElement($settings, $value)
 {
     silverwp_debug_var($value);
     $this->setValue($value);
     $html = '<div class="silver-vc-field-radio">';
     $options = $this->getOptions();
     foreach ($options as $option) {
         $html .= $this->html($option['value'], $option['label']);
     }
     $html .= '</div>';
     return $html;
 }
Example #2
0
        public static function backend_html()
        {
            $username = trim(avia_get_option('updates_username'));
            $apikey = trim(avia_get_option('updates_api_key'));
            $output = "";
            $version = self::get_version();
            $themename = self::get_themename();
            $parent_string = is_child_theme() ? "Parent Theme (" . ucfirst($themename) . ")" : "Theme";
            silverwp_debug_var($themename);
            silverwp_debug_var($apikey);
            if (empty($username) || empty($apikey)) {
                $output = "<div class='avia_backend_theme_updates'><h3>Theme Updates</h3>";
                $output .= "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 " . $parent_string . " Version Number is <strong>" . $version . "</strong></div>";
                echo $output;
            } else {
                if ($update = self::check_for_theme_update()) {
                    $target = network_admin_url('update-core.php?action=do-theme-upgrade');
                    $new = $update['new_version'];
                    //$themename  = 'Platform'; //testing theme
                    ob_start();
                    wp_nonce_field('upgrade-core');
                    $nonce = ob_get_clean();
                    $output = "<div class='avia_backend_theme_updates'>";
                    $output .= "<h3>Update Available!</h3>";
                    $output .= "A new Version (" . $new . ") of your " . $parent_string . " is available! You are using Version " . $version . ". <br/>Do you want to update?<br/><br/>";
                    //$output .= "";
                    $output .= '<span class="avia_style_wrap"><a href="#" data-avia-popup="avia-tmpl-theme-update" class="avia_button">Update Now!</a></span></div>';
                    $form = '<form method="post" action="' . $target . '" name="upgrade-themes" class="upgrade">
								<input type="hidden" name="checked[]" value="' . $themename . '" />
								' . $nonce . '
								<input type="hidden" name="_wp_http_referer" value="/wp-admin/update-core.php?action=do-theme-upgrade" />
								<p>
									<strong>Attention: Any modifications made to the <u>Theme Files</u> will be lost when updating. If you did change any files (Custom CSS rules or PHP file modifications for example) make sure to create a theme backup.</strong><br/><br/>Your backend settings, posts and pages wont be affected by the update.<br/>
								</p>
								<p class="avia-popup-button-container">
									<input id="upgrade-themes" class="button" type="submit" value="Update Theme" name="upgrade"/>
									<input id="upgrade-themes-close" class="button button-2nd script-close-avia-popup" type="submit" value="Don\'t Update" name="close"/>
								</p>
							</form>';
                    $output .= "<script type='text/html' id='avia-tmpl-theme-update'>\n{$form}\n</script>\n\n";
                } else {
                    $target = network_admin_url('update-core.php?force-check=1');
                    $output = "<div class='avia_backend_theme_updates'><h3>Theme Updates</h3>";
                    $output .= "No Updates available. You are running the latest version! ({$version})";
                    $output .= "<br/><br/> <a href='{$target}'>Check Manually</a> </div>";
                }
            }
            return $output;
        }