/** * Inits module scripts * * @access public * @return void */ public static function initScripts() { $out = '<script type="text/javascript">'; $out .= 'mthemeURI="' . MTHEME_URI . '";'; $out .= 'mthemeTitle="' . __('Insert Shortcode', 'mtheme') . '";'; $out .= 'mthemeShortcodes={'; foreach (MthemeCore::$components['shortcodes'] as $shortcode) { $out .= $shortcode['id'] . ':"' . $shortcode['name'] . '",'; } $out .= '}'; $out .= '</script>'; echo mtheme_html($out); }
/** * Show Image Field. * * @param array $field * @param array $meta * @since 1.0 * @access public */ public function show_field_image($field, $meta) { $this->show_field_begin($field, $meta); $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false); if (is_array($meta)) { if (isset($meta[0]) && is_array($meta[0])) { $meta = $meta[0]; } } if (is_array($meta) && isset($meta['src']) && $meta['src'] != '') { $html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='height: 150px;width: 150px;' /></span>"; $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />"; $html .= "<input type='hidden' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />"; $html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='Delete Image' />"; } else { $html .= "<span class='mupload_img_holder'></span>"; $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />"; $html .= "<input type='hidden' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />"; $html .= "<input class='at-upload_image_button button' type='button' rel='" . $field['id'] . "' value='Upload Image' />"; } echo mtheme_html($html); $this->show_field_end($field, $meta); }
<?php } elseif ($logo_position == 'header' || $logo_position == 'both') { ?> <!--HEADER--> <div class="header header-hide"> <div class="container"> <nav class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <a class="navbar-brand" href="<?php echo SITE_URL; ?> "><img src="<?php echo MthemeCore::getOption("site_logo", CHILD_URI . "site/img/logo.png"); ?> " alt=""/></a> </div> </nav> </div> </div> <!--/HEADER--> <?php } if (!empty($event_slider)) { echo '<div id="home_slider">'; echo do_shortcode('[hero_background logo_position="' . $logo_position . '" slider_id="' . $event_slider . '"]'); echo '</div>'; } echo mtheme_html($out); } get_footer();
/** * Adds custom fonts * * @access public * @return void */ public static function renderFonts() { $fonts = array(); $nice_scrool = MthemeCore::getOption('nice_scrool', 'true'); $out = '<script type="text/javascript">'; $out .= 'window.globalNiceScroolVar = "' . esc_js($nice_scrool) . '";'; $out .= 'window.years = "' . esc_js(__('Years', 'mtheme')) . '";'; $out .= 'window.months = "' . esc_js(__('Months', 'mtheme')) . '";'; $out .= 'window.weeks = "' . esc_js(__('Weeks', 'mtheme')) . '";'; $out .= 'window.days = "' . esc_js(__('Days', 'mtheme')) . '";'; $out .= 'window.hours = "' . esc_js(__('Hours', 'mtheme')) . '";'; $out .= 'window.minutes = "' . esc_js(__('Minutes', 'mtheme')) . '";'; $out .= 'window.seconds = "' . esc_js(__('Seconds', 'mtheme')) . '";'; $out .= 'window.year = "' . esc_js(__('Year', 'mtheme')) . '";'; $out .= 'window.month = "' . esc_js(__('Month', 'mtheme')) . '";'; $out .= 'window.week = "' . esc_js(__('Week', 'mtheme')) . '";'; $out .= 'window.day = "' . esc_js(__('Day', 'mtheme')) . '";'; $out .= 'window.hour = "' . esc_js(__('Hour', 'mtheme')) . '";'; $out .= 'window.minute = "' . esc_js(__('Minute', 'mtheme')) . '";'; $out .= 'window.second = "' . esc_js(__('Second', 'mtheme')) . '";'; $out .= '</script>'; echo mtheme_html($out); $out = ''; $out .= '<script type="text/javascript">'; $out .= 'window.globalDateVar=[];'; $out .= 'window.globalSpeakersSlider=[];'; $out .= 'window.globalSpeakersSliderAutoplay=[];'; $out .= 'window.globalcbpFWTabs=[];'; $out .= 'window.globalSponsorGallery=[];'; $out .= 'window.globalSponsorSlideWidth=[];'; $out .= 'window.globalSponsorSlideHeight=[];'; $out .= 'window.globalNLForm=[];'; $out .= 'window.globalGridGallery=[];'; $out .= 'window.globalThreeDImageId=[];'; $out .= 'window.globalEventVideoHoverId=[];'; $out .= 'window.globalTotalTabs=[];'; $out .= 'window.globalcbpFWTabsId=[];'; $out .= 'window.globalThreeDImageHoverOut=[];'; $out .= 'window.globalThreeDImageHoverColor=[];'; $out .= 'window.globalEventVideoHoverColor=[];'; $out .= 'window.globalEventVideoHoverOut=[];'; $out .= '</script>'; echo mtheme_html($out); $out = ''; foreach (MthemeCore::$options as $option) { if ($option['type'] == 'select_font') { $font = MthemeCore::getOption($option['id'], $option['default']); if ($font == 'Open Sans') { $font .= ':300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'; } else { $font .= ':400,700,600,500,300,200,100,800,900'; } if ($font == 'Crete Round') { $out .= '<style type="text/css">@font-face { font-family: "Crete Round"; src: url("' . THEME_URI . 'site/fonts/creteround-regular-webfont.eot"); src: url("' . THEME_URI . 'site/fonts/creteround-regular-webfont.eot?#iefix") format("embedded-opentype"), url("' . THEME_URI . 'site/fonts/creteround-regular-webfont.woff") format("woff"), url("' . THEME_URI . 'site/fonts/creteround-regular-webfont.ttf") format("truetype"), url("' . THEME_URI . 'site/fonts/creteround-regular-webfont.svg#crete_roundregular") format("svg"); font-weight: normal; font-style: normal; }</style>'; } else { $fonts[] = $font; } } } $fonts = array_unique($fonts); if (!empty($fonts)) { $out .= '<script type="text/javascript"> WebFontConfig = {google: { families: [ "' . implode($fonts, '","') . '" ] } }; (function() { var wf = document.createElement("script"); wf.src = ("https:" == document.location.protocol ? "https" : "http") + "://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js"; wf.type = "text/javascript"; wf.async = "true"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(wf, s); })(); </script>'; echo mtheme_html($out); } }
/** * Upgrades content and theme options * * @access public * @return void */ public static function upgrade() { global $pagenow, $wpdb; $out = '<div class="error"><p>'; $out .= 'Database is updated! Now you can edit content and change theme options.'; /*if(isset($_GET['upgraded'])) { $options=array( 'logo_image' => 'site_logo', ); foreach($options as $old => $new) { $wpdb->query("UPDATE $wpdb->options SET option_name='mtheme_$new' WHERE option_name='mtheme_$old'"); } $out.='Database is updated! Now you can edit content and change theme options.'; } else { $out.='Update the database to use Mtheme 2.0. Please make a backup before updating. <a href="'.admin_url('themes.php?activated=true&upgraded=true').'">Update Now</a>'; }*/ $out .= '</p></div>'; echo mtheme_html($out); }
/** * Renders messages * * @access public * @param array $messages * @param bool $success * @return void */ public static function renderMessages($success = false) { $out = ''; $class = 'error'; if ($success) { $class = 'success'; } if (isset(self::$messages)) { $out .= '<ul class="' . $class . '">'; foreach (self::$messages as $message) { $out .= '<li>' . $message . '</li>'; } $out .= '</ul>'; } echo mtheme_html($out); }
/** * Adds new field * * @access public * @return void */ public static function addField() { $slug = sanitize_text_field($_POST['value']); $out = self::renderField(array('id' => uniqid(), 'name' => '', 'type' => 'string', 'form' => $slug)); echo mtheme_html($out); die; }
/** * Shows simple dropdown * * @param array $args * @return void */ function mtheme_dropdown($args) { $defaults = array('options' => null, 'selected' => 0, 'is_show_option_all' => false, 'show_option_all' => '', 'name' => 'select_box', 'id' => '', 'class' => ''); $out = '<select name="' . $args['name'] . '" id="' . $args['id'] . '" class="' . $args['class'] . '">'; if ($args['is_show_option_all']) { $out .= '<option value="0">' . $args['show_option_all'] . '</option>'; } if (!empty($args['options'])) { foreach ($args['options'] as $option) { $selected = ''; if ($option == $args['selected']) { $selected = 'selected="selected"'; } $out .= '<option value="' . $option . '" ' . $selected . '>' . $option . '</option>'; } } $out .= '</select>'; echo mtheme_html($out); }