Example #1
0
function sh_widget_init()
{
    global $wp_registered_sidebars;
    $theme_options = _WSH()->option();
    //if( class_exists( 'SH_About_Us' ) )register_widget( 'SH_About_Us' );
    if (class_exists('SH_Contact_Info')) {
        register_widget('SH_Contact_Info');
    }
    if (class_exists('SH_Contact_Form')) {
        register_widget('SH_Contact_Form');
    }
    register_sidebar(array('name' => esc_html__('Default Sidebar', SH_NAME), 'id' => 'default-sidebar', 'description' => esc_html__('Widgets in this area will be shown on the right-hand side.', SH_NAME), 'class' => '', 'before_widget' => '<div id="%1$s" class="widget clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="widget-title clearfix"><h3>', 'after_title' => '</h3></div>'));
    register_sidebar(array('name' => esc_html__('Footer Sidebar', SH_NAME), 'id' => 'footer-sidebar', 'description' => esc_html__('Widgets in this area will be shown on the footer.', SH_NAME), 'class' => '', 'before_widget' => '<div id="%1$s" class="clearfix %2$s">', 'after_widget' => '</div>', 'before_title' => '<h4>', 'after_title' => '</h4>'));
    if (!is_object(_WSH())) {
        return;
    }
    $sidebars = sh_set(sh_set($theme_options, 'dynamic_sidebar'), 'dynamic_sidebar');
    foreach (array_filter((array) $sidebars) as $sidebar) {
        if (sh_set($sidebar, 'topcopy')) {
            continue;
        }
        $name = sh_set($sidebar, 'sidebar_name');
        if (!$name) {
            continue;
        }
        $slug = sh_slug($name);
        register_sidebar(array('name' => $name, 'id' => $slug, 'before_widget' => '<div class="widget">', 'after_widget' => "</div>", 'before_title' => '<div class="widget-title"><h3><span class="divider"></span>', 'after_title' => '</h3></div>'));
    }
    update_option('wp_registered_sidebars', $wp_registered_sidebars);
}
Example #2
0
function sh_admin_custom_scripts()
{
    global $pagenow;
    if ($pagenow == 'themes.php' && sh_set($_GET, 'page') == SH_NAME . '_option' || sh_set($_REQUEST, 'action') == 'vp_ajax_wp_genuine_theme_options_save') {
        wp_enqueue_script('vp-metabox', get_template_directory_uri() . '/includes/vafpress/public/js/metabox.min.js', '', '', true);
    }
}
 function launch()
 {
     $theme_options = _WSH()->option();
     $theme_options_url = admin_url('themes.php?page=' . SH_NAME . '_option');
     $this->purchase_code = sh_set($theme_options, 'sh_purchase_code');
     $this->purchase_user = sh_set($theme_options, 'sh_purchase_user');
     if (function_exists('wp_get_theme')) {
         $this->theme_data = wp_get_theme(get_option('template'));
         $this->theme_version = $this->theme_data->Version;
     } else {
         $this->theme_data = get_theme_data(get_template_directory() . '/style.css');
         $this->theme_version = $this->theme_data['Version'];
     }
     $this->theme_base = get_option('template');
     if (!$this->purchase_code && !$this->purchase_user) {
         $this->errors[] = sprintf(__('<strong>%s Theme Notice:</strong> Please enter a valid <a href="%s">purchase code and themeforest username</a> to get automatic theme update', SH_NAME), $this->theme_data['Name'], $theme_options_url);
     }
     add_action('admin_notices', array($this, '_admin_notice'));
     if ($this->errors) {
         return;
     }
     /**************************************************/
     //Uncomment below to find the theme slug that will need to be setup on the api server
     //var_dump($theme_base);
     add_filter('pre_set_site_transient_update_themes', array($this, 'check_for_update'));
     // Take over the Theme info screen on WP multisite
     add_filter('themes_api', array($this, 'my_theme_api_call'), 10, 3);
     if (is_admin()) {
         $this->current = get_transient('update_themes');
     }
 }
Example #4
0
function vc_theme_vc_row($atts, $content = null)
{
    extract(shortcode_atts(array('el_class' => '', 'el_id' => '', 'bg_image' => '', 'bg_color' => '', 'bg_image_repeat' => '', 'font_color' => '', 'padding' => '', 'margin_bottom' => '', 'container' => '', 'css' => ''), $atts));
    $atts['base'] = '';
    wp_enqueue_style('js_composer_front');
    wp_enqueue_script('wpb_composer_front_js');
    wp_enqueue_style('js_composer_custom_css');
    $vc_row = new WPBakeryShortCode_VC_Row($atts);
    $el_class = $vc_row->getExtraClass($el_class);
    $output = '';
    $css_class = $el_class;
    $id = sh_set($atts, 'el_id') ? ' id="' . $atts['el_id'] . '"' : '';
    if ($css) {
        $css_class .= vc_shortcode_custom_css_class($css, ' ') . ' ';
    }
    $style = $vc_row->buildStyle($bg_image, $bg_color, $bg_image_repeat, $font_color, $padding, $margin_bottom);
    //$boxed = sh_set( _WSH()->option(), 'boxed_layout' );
    //if( $css_class) exit($css_class);
    if ($container) {
        return '<section class="section ' . $css_class . '" ' . $style . $id . ' >
		<div class="container">
			<div class="general-row">
				' . wpb_js_remove_wpautop($content) . '
			</div>
		</div>
	<div class="clearfix"></div>
	</section>
	' . "\n";
    }
    return '<section class="section ' . $css_class . ' general-row" ' . $style . $id . ' >
		' . wpb_js_remove_wpautop($content) . '
	<div class="clearfix"></div>
	</section>
	' . "\n";
}
Example #5
0
 function updateNavMenuItem($menu_id, $menu_item_db_id, $args)
 {
     $isTopLevel = $args['menu-item-parent-id'] == 0 ? true : false;
     $sidebar = '';
     if (!$isTopLevel) {
         $parent_id = $args['menu-item-parent-id'];
         $parent_status = get_post_meta($parent_id, '_menu_item_status', true);
         update_post_meta($menu_item_db_id, '_menu_item_status', $parent_status);
     } else {
         $status = 'inactive';
         if (isset($_POST['megamenu_status'][$menu_item_db_id]) && $_POST['megamenu_status'][$menu_item_db_id] == 'active') {
             $status = 'active';
         }
         update_post_meta($menu_item_db_id, '_menu_item_status', $status);
     }
     //printr($_POST);
     if ($isTopLevel) {
         /** Store other fields*/
         update_post_meta($menu_item_db_id, '_sh_menu_columns', sh_set(sh_set($_POST, '_sh_menu_columns'), $menu_item_db_id, 2));
     }
     if (isset($_POST['_sh_menu_sidebar'][$menu_item_db_id]) && !empty($_POST['_sh_menu_sidebar'][$menu_item_db_id])) {
         $sidebar = $_POST['_sh_menu_sidebar'][$menu_item_db_id];
     }
     update_post_meta($menu_item_db_id, '_sh_menu_sidebar', $sidebar);
     update_post_meta($menu_item_db_id, '_sh_menu_item_submenu_type', sh_set(sh_set($_POST, 'menu_item_submenu_type'), $menu_item_db_id, 'default_dropdown'));
 }
Example #6
0
 function get_term_meta($id = '', $key = '')
 {
     global $post, $post_type;
     $id = $id ? $id : sh_set($post, 'ID');
     $key = $key ? $key : '_sh_' . $post_type . '_settings';
     $meta = get_post_meta($id, $key, true);
     return $meta ? $meta : false;
 }
Example #7
0
 function maintainance()
 {
     $options = _WSH()->option();
     if (sh_set($options, 'maintainance_status')) {
         $m_page = sh_set($options, 'maintainance_page');
         if ($m_page && !is_user_logged_in() && !is_page($m_page)) {
             wp_redirect(get_permalink($m_page));
         }
     }
 }
Example #8
0
 function bistro_slider()
 {
     $settings = (include get_template_directory() . '/includes/resource/post_types.php');
     foreach ($options as $k => $v) {
         $labels = $this->labels(sh_set($v, 'labels'), sh_set($v, 'label_args'));
         $rewrite = array('slug' => sh_set($v, 'slug'), 'with_front' => true, 'pages' => true, 'feeds' => false);
         $args = $this->args(array('labels' => $labels, 'supports' => sh_set($v, 'supports'), 'rewrite' => $rewrite));
         $args = wp_parse_args(sh_set($v, 'args'), $args);
         register_post_type($k, $args);
     }
 }
Example #9
0
 public static function withArray($arr = array(), $class_name = null)
 {
     if (is_null($class_name)) {
         $instance = new self();
     } else {
         $instance = new $class_name();
     }
     $instance->_basic_make($arr);
     $instance->_fields = sh_set($arr, 'fields');
     $instance->_alchemy = new VP_MetaBox_Alchemy1(array('id' => $instance->get_name(), 'template' => array(array('type' => 'group', 'repeating' => true, 'name' => $instance->get_name(), 'title' => $instance->get_label(), 'fields' => $instance->_fields))));
     return $instance;
 }
Example #10
0
 function create_atts($array = array())
 {
     //$contents = '';
     $atts = array();
     foreach ($array['params'] as $arr) {
         if ($arr['param_name'] == 'content') {
             continue;
         }
         $atts[$arr['param_name']] = sh_set($arr, 'default') ? sh_set($arr, 'default') : '';
     }
     return $atts;
 }
Example #11
0
 function __construct()
 {
     // Hook into the 'init' action
     //add_action( 'init', array($this, 'taxonomies'), 0 );
     $theme_option = _WSH()->option();
     $this->team_cat_slug = sh_set($theme_option, 'team_category_permalink', 'team_category');
     $this->services_cat_slug = sh_set($theme_option, 'services_category_permalink', 'services_category');
     $this->projects_cat_slug = sh_set($theme_option, 'projects_category_permalink', 'projects_category');
     $this->gallery_cat_slug = sh_set($theme_option, 'gallery_category_permalink', 'gallery_category');
     $this->testimonials_cat_slug = sh_set($theme_option, 'testimonial_category_permalink', 'testimonials_category');
     $this->faq_cat_slug = sh_set($theme_option, 'faq_category_permalink', 'faq_category');
     $this->taxonomies();
 }
Example #12
0
 function __construct()
 {
     // Hook into the 'init' action
     add_action('init', array($this, 'taxonomies'), 0);
     $theme_option = _WSH()->option();
     $this->team_cat_slug = sh_set($theme_option, 'team_category_permalink', 'team_category');
     $this->projects_cat_slug = sh_set($theme_option, 'projects_category_permalink', 'projects_category');
     $this->causes_cat_slug = sh_set($theme_option, 'causes_category_permalink', 'causes_category');
     $this->events_cat_slug = sh_set($theme_option, 'events_category_permalink', 'events_category');
     $this->gallery_cat_slug = sh_set($theme_option, 'gallery_category_permalink', 'gallery_category');
     $this->testimonials_cat_slug = sh_set($theme_option, 'testimonials_category_permalink', 'testimonials_category');
     $this->donars_cat_slug = sh_set($theme_option, 'donars_category_permalink', 'donars_category');
 }
Example #13
0
    function wp_footer()
    {
        $analytics = sh_set(_WSH()->option(), 'footer_analytics');
        if ($analytics) {
            ?>
			<script type="text/javascript">
                <?php 
            echo $analytics;
            ?>
            </script>
        <?php 
        }
    }
Example #14
0
    function wp_footer()
    {
        $theme_options = _WSH()->option();
        if (sh_set($theme_options, 'footer_analytics')) {
            ?>
			<script type="text/javascript">
                <?php 
            echo sh_set($theme_options, 'footer_analytics');
            ?>
            </script>
        <?php 
        }
    }
Example #15
0
 function publish_post($post_id)
 {
     global $post;
     $post_type = sh_set($_POST, 'post_type');
     $setting = sh_set($this->_fields, $post_type);
     $types = array_merge(array('post', 'page'), array_keys($this->_fields));
     if (!in_array($post_type, $types)) {
         return;
     }
     $data = sh_set($_POST, $post_type);
     //array_intersect_key( $_POST, $setting);
     if (!$data) {
         return;
     }
     //printr($post);
     if ($post_type == 'bistro_deal') {
         update_post_meta($post_id, '_bistro_bistro_deal_date', strtotime(sh_set($data, 'end_date')));
     }
     update_post_meta($post_id, '_bistro_' . $post_type . '_settings', $data);
 }
Example #16
0
 function sh_contact_form_submit()
 {
     if (!count($_POST)) {
         return;
     }
     _load_class('validation', 'helpers', true);
     $t =& $GLOBALS['_sh_base'];
     //printr($t);
     $settings = get_option(SH_NAME . '_theme_options');
     /** set validation rules for contact form */
     $t->validation->set_rules('contact_name', '<strong>' . __('Name', SH_NAME) . '</strong>', 'required|min_length[4]|max_lenth[30]');
     $t->validation->set_rules('contact_email', '<strong>' . __('Email', SH_NAME) . '</strong>', 'required|valid_email');
     //$t->validation->set_rules('contact_name','<strong>'.__('Phone', SH_NAME).'</strong>', 'required|min_length[5]');
     $t->validation->set_rules('contact_message', '<strong>' . __('Message', SH_NAME) . '</strong>', 'required|min_length[10]');
     if (sh_set($settings, 'captcha_status') == 'on') {
         if (sh_set($_POST, 'contact_captcha') !== sh_set($_SESSION, 'captcha')) {
             $t->validation->_error_array['captcha'] = __('Invalid captcha entered, please try again.', SH_NAME);
         }
     }
     $messages = '';
     if ($t->validation->run() !== FALSE && empty($t->validation->_error_array)) {
         //exit('ssssss');
         $name = $t->validation->post('contact_name');
         $email = $t->validation->post('contact_email');
         $message = $t->validation->post('contact_message');
         $contact_to = sh_set($settings, 'contact_email') ? sh_set($settings, 'contact_email') : get_option('admin_email');
         $headers = 'From: ' . $name . ' <' . $email . '>' . "\r\n";
         wp_mail($contact_to, __('Contact Us Message', SH_NAME), $message, $headers);
         $message = sh_set($settings, 'success_message') ? $settings['success_message'] : sprintf(__('Thank you <strong>%s</strong> for using our Contact form! Your email was successfully sent and we will be in touch with you soon.', SH_NAME), $name);
         $messages = '<div class="alert alert-success">' . __('SUCCESS! ', SH_NAME) . $message . '</div>';
     } else {
         if (is_array($t->validation->_error_array)) {
             foreach ($t->validation->_error_array as $msg) {
                 $messages .= '<div class="alert alert-danger"><span class="red">' . __('Error! ', SH_NAME) . '</span>' . $msg . '</div>';
             }
         }
     }
     echo $messages;
     exit;
     return $messages;
 }
Example #17
0
function sh_widget_init()
{
    register_widget("TW_featured_posts");
    register_widget("TW_Flickr");
    register_widget("TW_Contact_info");
    register_widget("TW_Contact_form");
    register_widget("TW_Twitter");
    register_widget("TW_Rise_info");
    global $wp_registered_sidebars;
    register_sidebar(array('name' => __('Default Sidebar', SH_NAME), 'id' => 'default-sidebar', 'description' => __('Widgets in this area will be shown on the right-hand side.', SH_NAME), 'class' => '', 'before_widget' => '<div class="widget animated fadeInUp in  %s" data-delay="0" data-animation="fadeInUp">', 'after_widget' => '</div>', 'before_title' => '<header class="heading"><h4>', 'after_title' => '</h4></header>'));
    register_sidebar(array('name' => __('Footer Sidebar', SH_NAME), 'id' => 'footer-sidebar', 'description' => __('Widgets in this area will be shown in Footer Area.', SH_NAME), 'class' => '', 'before_widget' => '<div class="col-md-3 col-sm-6 col-xs-12"><div class="widget %s">', 'after_widget' => '</div></div>', 'before_title' => '<div class="heading"><h4>', 'after_title' => '</h4></div>'));
    $sidebars = sh_set(sh_set(get_option(SH_NAME . '_theme_options'), 'dynamic_sidebar'), 'dynamic_sidebar');
    foreach (array_filter((array) $sidebars) as $sidebar) {
        if (sh_set($sidebar, 'topcopy')) {
            break;
        }
        $slug = sh_slug($sidebar);
        register_sidebar(array('name' => sh_set($sidebar, 'sidebar_name'), 'id' => sh_set($slug, 'sidebar_name'), 'before_widget' => '<div class="widget">', 'after_widget' => "</div>", 'before_title' => '<div class="widget-title"><h4>', 'after_title' => '</h4></div>'));
    }
    update_option('wp_registered_sidebars', $wp_registered_sidebars);
}
Example #18
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        ?>
		
		<div class="col-md-3 col-sm-6 col-xs-12">
		
		<?php 
        echo $before_widget;
        ?>
		
        <div class="widget_twitter">
		
		<?php 
        echo $before_title . $title . $after_title;
        ?>
		<?php 
        $number = sh_set($instance, 'number') ? esc_attr(sh_set($instance, 'number')) : 2;
        ?>

		<script type="text/javascript"> jQuery(document).ready(function($) {$('#twitter_update').tweets({screen_name: '<?php 
        echo $instance['twitter_id'];
        ?>
', number: <?php 
        echo $number;
        ?>
});});</script>
		<ul id="twitter_update" class="twitter_feed"></ul>
        </div>
		<?php 
        echo $after_widget;
        ?>
		</div>
<?php 
    }
Example #19
0
function sh_register_dynamic_sidebar()
{
    $theme_options = get_option(SH_NAME . '_theme_options');
    $sidebars = sh_set(sh_set($theme_options, 'dynamic_sidebar'), 'dynamic_sidebar');
    if ($sidebars && is_array($sidebars)) {
        foreach ($sidebars as $sidebar) {
            if (isset($sidebar['tocopy'])) {
                continue;
            }
            register_sidebar(array('name' => $sidebar['sidebar_name'], 'id' => sh_slug($sidebar['sidebar_name']), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => "</div>", 'before_title' => '<h4 class="title"><span>', 'after_title' => '</span></h4>'));
        }
    }
}
Example #20
0
<?php

/** Template Name: Post VC*/
?>

<?php 
$meta = _WSH()->get_meta('_sh_layout_settings');
$meta1 = _WSH()->get_meta('_sh_header_settings');
$bg = sh_set($meta1, 'bg_image');
$bg = $bg ? $bg : get_template_directory_uri() . '/images/other/parallax.jpg';
$layout = sh_set($meta, 'layout', 'full');
$sidebar = sh_set($meta, 'sidebar', 'blog-sidebar');
$classes = !$layout || $layout == 'full' ? ' col-lg-12 col-md-12' : ' col-lg-9 col-md-9';
if (!sh_set($_GET, 'ajax')) {
    get_header();
    /** Update the post views counter */
    //_WSH()->post_views( true );
    ?>

<link rel="stylesheet" id="js_composer_front-css" href="http://localhost/denken/wp-content/plugins/js_composer/assets/css/js_composer.css?ver=4.7" type="text/css" media="all">



<?php 
    _sh_show_menu_by_position('above');
    ?>

<div class="page-header parallax" style="background-image: url(<?php 
    echo esc_url($bg);
    ?>
);"></div>
    ?>
" id="client<?php 
    the_ID();
    ?>
">
										<p>
											<?php 
    echo _sh_trim(get_the_content(), $limit);
    ?>
										</p>
										<h4 class="uppercase"><?php 
    the_title();
    ?>
</h4>
										<span><?php 
    echo balanceTags(sh_set($meta, 'designation'));
    ?>
</span>
									</div><!-- / .tab-pane -->
					
					<?php 
}
wp_reset_postdata();
$post_data = ob_get_clean();
ob_start();
?>

				<div class="padding">

					<?php 
if ($title) {
Example #22
0
get_header();
if ($wp_query->is_posts_page) {
    $meta = _WSH()->get_meta('_sh_layout_settings', get_queried_object()->ID);
    $title = get_the_title(get_queried_object());
    $meta1 = _WSH()->get_meta('_sh_header_settings');
    $bg = sh_set($meta1, 'bg_image');
    $bg = $bg ? $bg : get_template_directory_uri() . '/images/other/parallax.jpg';
} else {
    $settings = _WSH()->option();
    $layout = sh_set($_GET, 'layout') ? sh_set($_GET, 'layout') : sh_set($settings, 'archive_page_layout');
    $layout = $layout ? $layout : 'right';
    $sidebar = sh_set($settings, 'archive_page_sidebar', 'default-sidebar');
    $bg = sh_set($settings, 'archive_page_header_img');
    $bg = $bg ? $bg : get_template_directory_uri() . '/images/other/parallax.jpg';
    $title = sh_set($settings, 'archive_page_title', 'Blog');
}
?>

<?php 
_sh_show_menu_by_position('above');
?>

<div class="page-header parallax" style="background-image: url(<?php 
echo esc_url($bg);
?>
);"></div>

<?php 
_sh_show_menu_by_position('below');
?>
Example #23
0
 /** create button return url with action */
 function action($action)
 {
     $return = sh_set($this->args, 'return') ? sh_set($this->args, 'return') : $this->return_url;
     return add_query_arg(array('action' => $action), $return);
 }
            $title = sh_set($options, 'author_page_title') ? sh_set($options, 'author_page_title') : get_queried_object()->data->dispaly_name;
            $text = sh_set($options, 'author_page_header_text');
        } else {
            if (is_archive('product')) {
                if (class_exists('woocommerce') && is_shop()) {
                    $post_id = get_option('woocommerce_shop_page_id');
                }
                $meta = _WSH()->get_meta('_sh_header_settings', $post_id);
                $bg = sh_set($meta, 'bg_image');
                $title = sh_set($meta, 'header_title') ? sh_set($meta, 'header_title') : get_the_title();
                $text = sh_set($meta, 'header_text') ? sh_set($meta, 'header_text') : 'A minimal make-up theme';
            } else {
                if (is_archive()) {
                    $bg = sh_set($options, 'archive_page_header_img');
                    $title = sh_set($options, 'archive_page_title') ? sh_set($options, 'archive_page_title') : get_queried_object()->data->dispaly_name;
                    $text = sh_set($options, 'archive_page_header_text');
                }
            }
        }
    }
}
?>

<div class="logo-wrapper">
    <h1><a href="<?php 
esc_url(home_url());
?>
" title="<?php 
echo esc_attr(get_bloginfo('name'));
?>
"><?php 
Example #25
0
<?php

get_header();
$theme_options = _WSH()->option();
?>
<article class="section">
	<div class="container">
	<h1 class="title_error"><?php 
echo sh_set($theme_options, 'page_title');
?>
</h1>
	<h5 class="text_error"><?php 
echo sh_set($theme_options, 'page_text');
?>
</h5>
	<h3 class="tagline_error"><?php 
echo sh_set($theme_options, 'page_tag_line');
?>
</h3>
	
	</div>
</article>

<?php 
get_footer();
 /**
  * Installs a plugin or activates a plugin depending on the hover
  * link clicked by the user.
  *
  * Checks the $_GET variable to see which actions have been
  * passed and responds with the appropriate method.
  *
  * Uses WP_Filesystem to process and handle the plugin installation
  * method.
  *
  * @since 1.0.0
  *
  * @uses WP_Filesystem
  * @uses WP_Error
  * @uses WP_Upgrader
  * @uses Plugin_Upgrader
  * @uses Plugin_Installer_Skin
  *
  * @return boolean True on success, false on failure
  */
 protected function do_plugin_install()
 {
     /** All plugin information will be stored in an array for processing */
     $plugin = array();
     /** Checks for actions from hover links to process the installation */
     if (isset($_GET[sanitize_key('plugin')]) && (isset($_GET[sanitize_key('tgmpa-install')]) && 'install-plugin' == $_GET[sanitize_key('tgmpa-install')])) {
         check_admin_referer('tgmpa-install');
         $plugin['name'] = $_GET[sanitize_key('plugin_name')];
         // Plugin name
         $plugin['slug'] = $_GET[sanitize_key('plugin')];
         // Plugin slug
         $plugin['source'] = $_GET[sanitize_key('plugin_source')];
         // Plugin source
         /** Pass all necessary information via URL if WP_Filesystem is needed */
         $url = wp_nonce_url(add_query_arg(array('page' => $this->menu, 'plugin' => $plugin['slug'], 'plugin_name' => $plugin['name'], 'plugin_source' => $plugin['source'], 'tgmpa-install' => 'install-plugin'), admin_url($this->parent_url_slug)), 'tgmpa-install');
         $method = '';
         // Leave blank so WP_Filesystem can populate it as necessary
         $fields = array(sanitize_key('tgmpa-install'));
         // Extra fields to pass to WP_Filesystem
         if (false === ($creds = request_filesystem_credentials($url, $method, false, false, $fields))) {
             return true;
         }
         if (!WP_Filesystem($creds)) {
             request_filesystem_credentials($url, $method, true, false, $fields);
             // Setup WP_Filesystem
             return true;
         }
         require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
         // Need for plugins_api
         require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
         // Need for upgrade classes
         /** Set plugin source to WordPress API link if available */
         if (isset($plugin['source']) && 'repo' == $plugin['source']) {
             $api = plugins_api('plugin_information', array('slug' => $plugin['slug'], 'fields' => array('sections' => false)));
             if (is_wp_error($api)) {
                 wp_die($this->strings['oops'] . var_dump($api));
             }
             if (isset($api->download_link)) {
                 $plugin['source'] = $api->download_link;
             }
         }
         /** Set type, based on whether the source starts with http:// or https:// */
         $type = preg_match('|^http(s)?://|', $plugin['source']) ? 'web' : 'upload';
         /** Prep variables for Plugin_Installer_Skin class */
         $title = sprintf($this->strings['installing'], $plugin['name']);
         $url = add_query_arg(array('action' => 'install-plugin', 'plugin' => $plugin['slug']), 'update.php');
         if (isset($_GET['from'])) {
             $url .= add_query_arg('from', urlencode(stripslashes($_GET['from'])), $url);
         }
         $nonce = 'install-plugin_' . $plugin['slug'];
         /** Prefix a default path to pre-packaged plugins */
         $source = 'upload' == $type ? $this->default_path . $plugin['source'] : $plugin['source'];
         /** Create a new instance of Plugin_Upgrader */
         $upgrader = new Plugin_Upgrader($skin = new Plugin_Installer_Skin(compact('type', 'title', 'url', 'nonce', 'plugin', 'api')));
         /** Perform the action and install the plugin from the $source urldecode() */
         $upgrader->install($source);
         /** Flush plugins cache so we can make sure that the installed plugins list is always up to date */
         wp_cache_flush();
         /** Only activate plugins if the config option is set to true */
         if ($this->is_automatic) {
             $plugin_activate = $upgrader->plugin_info();
             // Grab the plugin info from the Plugin_Upgrader method
             $activate = activate_plugin($plugin_activate);
             // Activate the plugin
             $this->populate_file_path();
             // Re-populate the file path now that the plugin has been installed and activated
             if (is_wp_error($activate)) {
                 echo '<div id="message" class="error"><p>' . $activate->get_error_message() . '</p></div>';
                 echo '<p><a href="' . add_query_arg('page', $this->menu, admin_url($this->parent_url_slug)) . '" title="' . esc_attr($this->strings['return']) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
                 return true;
                 // End it here if there is an error with automatic activation
             } else {
                 echo '<p>' . $this->strings['plugin_activated'] . '</p>';
             }
         }
         /** Display message based on if all plugins are now active or not */
         $complete = array();
         foreach ($this->plugins as $plugin) {
             if (!is_plugin_active($plugin['file_path'])) {
                 echo '<p><a href="' . add_query_arg('page', $this->menu, admin_url($this->parent_url_slug)) . '" title="' . esc_attr($this->strings['return']) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
                 $complete[] = $plugin;
                 break;
             } else {
                 $complete[] = '';
             }
         }
         /** Filter out any empty entries */
         $complete = array_filter($complete);
         /** All plugins are active, so we display the complete string and hide the plugin menu */
         if (empty($complete)) {
             echo '<p>' . sprintf($this->strings['complete'], '<a href="' . admin_url() . '" title="' . esc_attr(sh_set($this->strings, 'domain')) . '">' . sh_set($this->strings, 'domain') . '</a>') . '</p>';
             echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
         }
         return true;
     } elseif (isset($_GET[sanitize_key('plugin')]) && (isset($_GET[sanitize_key('tgmpa-activate')]) && 'activate-plugin' == $_GET[sanitize_key('tgmpa-activate')])) {
         check_admin_referer('tgmpa-activate', 'tgmpa-activate-nonce');
         /** Populate $plugin array with necessary information */
         $plugin['name'] = $_GET[sanitize_key('plugin_name')];
         $plugin['slug'] = $_GET[sanitize_key('plugin')];
         $plugin['source'] = $_GET[sanitize_key('plugin_source')];
         $plugin_data = get_plugins('/' . $plugin['slug']);
         // Retrieve all plugins
         $plugin_file = array_keys($plugin_data);
         // Retrieve all plugin files from installed plugins
         $plugin_to_activate = $plugin['slug'] . '/' . $plugin_file[0];
         // Match plugin slug with appropriate plugin file
         $activate = activate_plugin($plugin_to_activate);
         // Activate the plugin
         if (is_wp_error($activate)) {
             echo '<div id="message" class="error"><p>' . $activate->get_error_message() . '</p></div>';
             echo '<p><a href="' . add_query_arg('page', $this->menu, admin_url($this->parent_url_slug)) . '" title="' . esc_attr($this->strings['return']) . '" target="_parent">' . $this->strings['return'] . '</a></p>';
             return true;
             // End it here if there is an error with activation
         } else {
             /** Make sure message doesn't display again if bulk activation is performed immediately after a single activation */
             if (!isset($_POST[sanitize_key('action')])) {
                 $msg = $this->strings['activated_successfully'] . ' <strong>' . $plugin['name'] . '</strong>';
                 echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
             }
         }
     }
     return false;
 }
Example #27
0
                        </li>
					<?php 
    }
}
?>
                    </ul>
                </div>
                <?php 
_the_pagination();
wp_reset_query();
?>
            </div>
			
            <?php 
if (sh_set($template_file, 'sidebar')) {
    ?>
        
            <div class="col-md-3 sidebar">
				   <?php 
    dynamic_sidebar(sh_set($template_file, 'sidebar'));
    ?>
     
            </div>
			<?php 
}
?>
			
        </div>
    </article>
<?php 
get_footer();
        echo '<li><a href="#section' . esc_attr($pages) . '">' . balanceTags($title) . '</a></li>';
    }
} else {
    $ref = sh_set($_SERVER, 'HTTP_REFERER');
    if ($ref) {
        echo '<li><a href="' . esc_url($ref) . '">' . esc_html__('Back', SH_NAME) . '</a></li>';
    } else {
        echo '<li><a href="' . esc_url(home_url()) . '">' . esc_html__('Back', SH_NAME) . '</a></li>';
    }
}
?>
                    </ul>
                </div>
			</div>
		</nav>

		
		<?php 
if ($menu_pos == 'above') {
    ?>
			<!-- Hero -->
			<div id="hero">
				<div class="banner">
					<?php 
    $slider = sh_set($theme_options, 'rev_slider');
    echo do_shortcode('[rev_slider ' . $slider . ']');
    ?>
				</div>
			</div>
		<?php 
}
Example #29
0
    ?>
                
                <?php 
    comments_template();
    ?>
            </div>
		  <?php 
}
?>
		  
            <?php 
if (sh_set($meta, 'sidebar')) {
    ?>
        
            <div class="col-md-3 sidebar">
				   <?php 
    dynamic_sidebar(sh_set($meta, 'sidebar'));
    ?>
     
            </div>
			<?php 
}
?>

            

        </div>

    </article>
<?php 
get_footer();
Example #30
0
$qo = get_queried_object();
$sizes = array(1 => '1142x470', 2 => '1142x470', 3 => '360x200', 4 => '264x150');
if ($qo) {
    $template_file = get_post_meta($qo->ID, 'page_meta', true);
    $col_num = sh_set($template_file, 'column_number', 1);
    $image = sh_set($template_file, 'image', get_template_directory_uri() . '/images/resource/banner-1.jpg');
    $is_home = sh_set($template_file, 'is_home', true);
    $sidebar = sh_set($template_file, 'sidebar');
} else {
    $col_num = sh_set($options, 'archive_column_number', 1);
    $image = sh_set($options, 'archive_bg_image');
    $image = $image ? $image : get_template_directory_uri() . '/images/resource/banner-1.jpg';
    $is_home = true;
    $sidebar = sh_set($options, 'archive_page_sidebar', 'default-sidebar');
}
$size = sh_set($sizes, $col_num);
if ($image) {
    ?>
<article class="banner" style="background-image:url(<?php 
    echo $image;
    ?>
);">
	<div class="container">
		<h1><?php 
    echo wp_title('');
    ?>
</h1>
		<?php 
    if (!$is_home) {
        echo get_the_breadcrumb();
    }