/** * Returns a boolean * check if user started to use the theme before ( strictly < ) the requested version * * @package Customizr * @since Customizr 3.2.9 */ function tc_user_started_before_version($_czr_ver, $_pro_ver = null) { $_ispro = TC___::tc_is_pro(); if ($_ispro && !get_transient('started_using_customizr_pro')) { return false; } if (!$_ispro && !get_transient('started_using_customizr')) { return false; } $_trans = $_ispro ? 'started_using_customizr_pro' : 'started_using_customizr'; $_ver = $_ispro ? $_pro_ver : $_czr_ver; if (!$_ver) { return false; } $_start_version_infos = explode('|', esc_attr(get_transient($_trans))); if (!is_array($_start_version_infos)) { return false; } switch ($_start_version_infos[0]) { //in this case with now exactly what was the starting version (most common case) case 'with': return version_compare($_start_version_infos[1], $_ver, '<'); break; //here the user started to use the theme before, we don't know when. //but this was actually before this check was created //here the user started to use the theme before, we don't know when. //but this was actually before this check was created case 'before': return true; break; default: return false; break; } }
/** * Render welcome admin page. * @package Customizr * @since Customizr 3.0.4 */ function tc_welcome_panel() { $is_help = isset($_GET['help']) ? true : false; $_faq_url = esc_url('http://docs.presscustomizr.com/category/90-faq-and-common-issues'); $_support_url = TC___::tc_is_pro() ? TC_WEBSITE . 'support-forums/forum/customizr-pro/' : esc_url('wordpress.org/support/theme/customizr'); $_theme_name = TC___::tc_is_pro() ? 'Customizr Pro' : 'Customizr'; do_action('__before_welcome_panel'); ?> <div id="customizr-admin-panel" class="wrap about-wrap"> <?php if ($is_help) { printf('<h1 style="font-size: 2.5em;" class="need-help-title">%1$s %2$s ?</h1>', __("Need help with", "customizr"), $_theme_name); } else { printf('<h1 class="need-help-title">%1$s %2$s %3$s</h1>', __("Welcome to", "customizr"), $_theme_name, CUSTOMIZR_VER); } ?> <?php if ($is_help) { ?> <div class="changelog"> <div class="about-text tc-welcome"> <?php printf('<p>%1$s</p>', sprintf(__("The best way to start is to read the %s.", "customizr"), sprintf('<a href="%1$s" title="%2$s" target="_blank">%2$s</a>', esc_url('docs.presscustomizr.com'), __("documentation", "customizr")))); printf('<p>%1$s</p><p><strong>%2$s</strong></p>', __("If you don't find an answer to your issue in the documentation, don't panic! The Customizr theme is used by a growing community of webmasters reporting bugs and making continuous improvements. If you have a problem with the theme, chances are that it's already been reported and fixed in the support forums.", "customizr"), sprintf(__("The easiest way to search in the support forums is to use our Google powered search engine on our %s.", "customizr"), sprintf('<a href="%1$s" title="%2$s" target="_blank">%2$s</a>', esc_url('presscustomizr.com'), __("home page", "customizr")))); ?> </div> <div class="feature-section col two-col"> <div class="col"> <br/> <a class="button-secondary customizr-help" title="documentation" href="<?php echo TC_WEBSITE; ?> customizr" target="_blank"><?php _e('Read the documentation', 'customizr'); ?> </a> </div> <div class="last-feature col"> <br/> <a class="button-secondary customizr-help" title="faq" href="<?php echo $_faq_url; ?> " target="_blank"><?php _e('Check the FAQ', 'customizr'); ?> </a> </div> </div><!-- .two-col --> <div class="feature-section col two-col"> <div class="col"> <a class="button-secondary customizr-help" title="code snippets" href="<?php echo TC_WEBSITE; ?> code-snippets/" target="_blank"><?php _e('Code snippets', 'customizr'); ?> </a> </div> <div class="last-feature col"> <a class="button-secondary customizr-help" title="forum" href="<?php echo $_support_url; ?> " target="_blank"><?php _e('Get support in the forum', 'customizr'); ?> </a> </div> </div><!-- .two-col --> </div><!-- .changelog --> <?php } else { ?> <div class="about-text tc-welcome"> <?php printf('<p><strong>%1$s %2$s <a href="#customizr-changelog">(%3$s)</a></strong></p>', sprintf(__("Thank you for using %s!", "customizr"), $_theme_name), sprintf(__("%s %s has more features, is safer and more stable than ever to help you designing an awesome website.", "customizr"), $_theme_name, CUSTOMIZR_VER), __("check the changelog", "customizr")); printf('<p><strong>%1$s</strong></p>', sprintf(__("The best way to start with %s is to read the %s and visit the %s.", "customizr"), $_theme_name, sprintf('<a href="%1$s" title="%2$s" target="_blank">%2$s</a>', esc_url('docs.presscustomizr.com'), __("documentation", "customizr")), sprintf('<a href="%1$s" title="%2$s" target="_blank">%2$s</a>', esc_url('demo.presscustomizr.com'), __("demo website", "customizr")))); ?> </div> <?php } ?> <?php if (TC___::$instance->tc_is_child()) { ?> <div class="changelog point-releases"></div> <div class="tc-upgrade-notice"> <p> <?php printf(__('You are using a child theme of Customizr %1$s : always check the %2$s after upgrading to see if a function or a template has been deprecated.', 'customizr'), 'v' . CUSTOMIZR_VER, '<strong><a href="#customizr-changelog">changelog</a></strong>'); ?> </p> </div> <?php } ?> <div class="changelog point-releases"></div> <?php if (!TC___::tc_is_pro()) { ?> <div class="changelog"> <div class="feature-section col three-col"> <div class="col"> <h3><?php _e('We need sponsors!', 'customizr'); ?> </h3> <p><?php _e('<strong>We do our best do make Customizr the perfect free theme for you!</strong><br/> Please help support it\'s continued development with a donation of $20, $50, or even $100.', 'customizr'); ?> </br> <a href="<?php echo esc_url('paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8CTH6YFDBQYGU'); ?> " target="_blank" rel="nofollow"><img class="tc-donate" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" alt="Make a donation for Customizr" /></a> </p> </div> <div class="col"> <h3><?php _e('Happy user of Customizr?', 'customizr'); ?> </h3> <p><?php _e('If you are happy with the theme, say it on wordpress.org and give Customizr a nice review! <br />(We are addicted to your feedbacks...)', 'customizr'); ?> </br> <a class="button-primary review-customizr" title="Customizr WordPress Theme" href="<?php echo esc_url('wordpress.org/support/view/theme-reviews/customizr'); ?> " target="_blank">Review Customizr »</a></p> </div> <div class="last-feature col"> <h3><?php _e('Follow us', 'customizr'); ?> </h3> <p class="tc-follow"><a href="<?php echo TC_WEBSITE . 'blog'; ?> " target="_blank"><img src="<?php echo TC_BASE_URL . 'inc/admin/img/pc.png'; ?> " alt="Press Customizr" /></a></p> <!-- Place this tag where you want the widget to render. --> </div><!-- .feature-section --> </div><!-- .feature-section col three-col --> </div><!-- .changelog --> <div id="extend" class="changelog"> <h3 style="text-align:left"><?php _e("Go Customizr Pro", 'customizr'); ?> </h3> <div class="feature-section images-stagger-right"> <a class="" title="<?php _e("Visit the extension's page", 'customizr'); ?> " href="<?php echo TC_WEBSITE; ?> customizr-pro/" target="_blank"><img alt="Customizr'extensions" src="<?php echo TC_BASE_URL . 'inc/admin/img/customizr-pro.png'; ?> " class=""></a> <h4 style="text-align: left"><?php _e('Easily take your web design one step further', 'customizr'); ?> </h4></br> <p style="text-align: left"><?php _e("The Customizr Pro WordPress theme allows anyone to create a beautiful, professional and fully responsive website in a few seconds. In the Pro version, you'll get all the features of the free version plus some really cool and even revolutionary ones.", 'customizr'); ?> </p> <p style="text-align:left"> <a class="button-primary review-customizr" title="<?php _e("Discover Customizr Pro", 'customizr'); ?> " href="<?php echo TC_WEBSITE; ?> customizr-pro/" target="_blank"><?php _e("Discover Customizr Pro", 'customizr'); ?> »</a> </p> </div> </div> <?php } //end if ! is_pro ?> <div id="showcase" class="changelog"> <h3 style="text-align:right"><?php _e('Customizr Showcase', 'customizr'); ?> </h3> <div class="feature-section images-stagger-left"> <a class="" title="<?php _e('Visit the showcase', 'customizr'); ?> " href="<?php echo TC_WEBSITE; ?> customizr/showcase/" target="_blank"><img alt="Customizr Showcase" src="<?php echo TC_BASE_URL . 'inc/admin/img/mu2.png'; ?> " class=""></a> <h4 style="text-align: right"><?php _e('Find inspiration for your next Customizr based website!', 'customizr'); ?> </h4> <p style="text-align: right"><?php _e('This showcase aims to show what can be done with Customizr and helping other users to find inspiration for their web design.', 'customizr'); ?> </p> <p style="text-align: right"><?php _e('Do you think you made an awesome website that can inspire people? Submitting a site for review is quick and easy to do.', 'customizr'); ?> </br> </p> <p style="text-align:right"> <a class="button-primary review-customizr" title="<?php _e('Visit the showcase', 'customizr'); ?> " href="<?php echo TC_WEBSITE; ?> customizr/showcase/" target="_blank"><?php _e('Visit the showcase', 'customizr'); ?> »</a> </p> </div> </div> <?php do_action('__after_welcome_panel'); ?> <div class="return-to-dashboard"> <a href="<?php echo esc_url(self_admin_url()); ?> "><?php is_blog_admin() ? _e('Go to Dashboard → Home', 'customizr') : _e('Go to Dashboard', 'customizr'); ?> </a> </div> </div><!-- //#customizr-admin-panel --> <?php }
$_args = isset($params[1]) ? $params[1] : null; //instanciates only for the following classes, the other are instanciated in their respective files. if ('TC_activation_key' == $name || 'TC_theme_check_updates' == $name) { new $name($_args); } } } /** * Helper : returns the modified array of class files to load and instanciate * Check the context * hook : tc_get_files_to_load_pro * * @return boolean * @since Customizr 3.3+ */ function tc_set_files_to_load_pro($_to_load) { if (!is_admin() || is_admin() && TC___::$instance->tc_is_customizing()) { unset($_to_load['TC_activation_key']); unset($_to_load['TC_theme_updater']); unset($_to_load['TC_theme_check_updates']); } return $_to_load; } } //end of class } //may be load pro if (TC___::tc_is_pro()) { new TC_init_pro(TC___::$theme_name); }
function __construct() { self::$instance =& $this; /* GETS INFORMATIONS FROM STYLE.CSS */ // get themedata version wp 3.4+ if (function_exists('wp_get_theme')) { //get WP_Theme object of customizr $tc_theme = wp_get_theme(); //Get infos from parent theme if using a child theme $tc_theme = $tc_theme->parent() ? $tc_theme->parent() : $tc_theme; $tc_base_data['prefix'] = $tc_base_data['title'] = $tc_theme->name; $tc_base_data['version'] = $tc_theme->version; $tc_base_data['authoruri'] = $tc_theme->{'Author URI'}; } else { $tc_base_data = call_user_func('get_' . 'theme_data', get_stylesheet_directory() . '/style.css'); $tc_base_data['prefix'] = $tc_base_data['title']; } self::$theme_name = sanitize_file_name(strtolower($tc_base_data['title'])); //CUSTOMIZR_VER is the Version if (!defined('CUSTOMIZR_VER')) { define('CUSTOMIZR_VER', $tc_base_data['version']); } //TC_BASE is the root server path of the parent theme if (!defined('TC_BASE')) { define('TC_BASE', get_template_directory() . '/'); } //TC_BASE_CHILD is the root server path of the child theme if (!defined('TC_BASE_CHILD')) { define('TC_BASE_CHILD', get_stylesheet_directory() . '/'); } //TC_BASE_URL http url of the loaded parent theme if (!defined('TC_BASE_URL')) { define('TC_BASE_URL', get_template_directory_uri() . '/'); } //TC_BASE_URL_CHILD http url of the loaded child theme if (!defined('TC_BASE_URL_CHILD')) { define('TC_BASE_URL_CHILD', get_stylesheet_directory_uri() . '/'); } //THEMENAME contains the Name of the currently loaded theme if (!defined('THEMENAME')) { define('THEMENAME', $tc_base_data['title']); } //TC_WEBSITE is the home website of Customizr if (!defined('TC_WEBSITE')) { define('TC_WEBSITE', $tc_base_data['authoruri']); } //this is the structure of the Customizr code : groups => ('path' , 'class_suffix') $this->tc_core = apply_filters('tc_core', array('fire' => array(array('inc', 'init'), array('inc', 'utils_settings_map'), array('inc', 'utils'), array('inc', 'resources'), array('inc', 'widgets'), array('inc/admin', 'admin_init'), array('inc/admin', 'admin_page')), 'header' => array(array('inc/parts', 'header_main'), array('inc/parts', 'menu'), array('inc/parts', 'nav_walker')), 'content' => array(array('inc/parts', '404'), array('inc/parts', 'attachment'), array('inc/parts', 'breadcrumb'), array('inc/parts', 'comments'), array('inc/parts', 'featured_pages'), array('inc/parts', 'gallery'), array('inc/parts', 'headings'), array('inc/parts', 'no_results'), array('inc/parts', 'page'), array('inc/parts', 'post_thumbnails'), array('inc/parts', 'post'), array('inc/parts', 'post_list'), array('inc/parts', 'post_metas'), array('inc/parts', 'post_navigation'), array('inc/parts', 'sidebar'), array('inc/parts', 'slider')), 'footer' => array(array('inc/parts', 'footer_main')), 'addons' => apply_filters('tc_addons_classes', array()))); //end of filters //check the context if (file_exists(sprintf('%sinc/init-pro.php', TC_BASE)) && 'customizr-pro' == self::$theme_name) { require_once sprintf('%sinc/init-pro.php', TC_BASE); self::$tc_option_group = 'tc_theme_options'; } else { self::$tc_option_group = 'tc_theme_options'; } //theme class groups instanciation $this->tc__($this->tc_core); }
/** * Do we display the featured page notice ? * @return bool * @since Customizr 3.4+ */ static function tc_is_fp_notice_on($_position = null) { //always display in DEV mode if (defined('TC_DEV') && true === TC_DEV) { return true; } $_dont_display_conditions = array(!is_user_logged_in() || !current_user_can('edit_theme_options'), !is_admin() && !TC_utils::$inst->tc_is_home(), !(bool) TC_utils::$inst->tc_opt('tc_show_featured_pages'), 'disabled' == get_transient("tc_fp_notice"), self::$instance->tc_is_one_fp_set(), TC___::tc_is_pro(), TC_plugins_compat::$instance->tc_is_plugin_active('tc-unlimited-featured-pages/tc_unlimited_featured_pages.php'), !self::$instance->tc_is_front_help_enabled()); //checks if at least one of the conditions is true return apply_filters('tc_is_fp_notice_on', !(bool) array_sum($_dont_display_conditions)); }
function __construct () { self::$instance =& $this; /* GETS INFORMATIONS FROM STYLE.CSS */ // get themedata version wp 3.4+ if( function_exists( 'wp_get_theme' ) ) { //get WP_Theme object of customizr $tc_theme = wp_get_theme(); //Get infos from parent theme if using a child theme $tc_theme = $tc_theme -> parent() ? $tc_theme -> parent() : $tc_theme; $tc_base_data['prefix'] = $tc_base_data['title'] = $tc_theme -> name; $tc_base_data['version'] = $tc_theme -> version; $tc_base_data['authoruri'] = $tc_theme -> {'Author URI'}; } // get themedata for lower versions (get_stylesheet_directory() points to the current theme root, child or parent) else { $tc_base_data = call_user_func('get_' .'theme_data', get_stylesheet_directory().'/style.css' ); $tc_base_data['prefix'] = $tc_base_data['title']; } self::$theme_name = sanitize_file_name( strtolower($tc_base_data['title']) ); //CUSTOMIZR_VER is the Version if( ! defined( 'CUSTOMIZR_VER' ) ) define( 'CUSTOMIZR_VER' , $tc_base_data['version'] ); //TC_BASE is the root server path of the parent theme if( ! defined( 'TC_BASE' ) ) define( 'TC_BASE' , get_template_directory().'/' ); //TC_BASE_CHILD is the root server path of the child theme if( ! defined( 'TC_BASE_CHILD' ) ) define( 'TC_BASE_CHILD' , get_stylesheet_directory().'/' ); //TC_BASE_URL http url of the loaded parent theme if( ! defined( 'TC_BASE_URL' ) ) define( 'TC_BASE_URL' , get_template_directory_uri() . '/' ); //TC_BASE_URL_CHILD http url of the loaded child theme if( ! defined( 'TC_BASE_URL_CHILD' ) ) define( 'TC_BASE_URL_CHILD' , get_stylesheet_directory_uri() . '/' ); //THEMENAME contains the Name of the currently loaded theme if( ! defined( 'THEMENAME' ) ) define( 'THEMENAME' , $tc_base_data['title'] ); //TC_WEBSITE is the home website of Customizr if( ! defined( 'TC_WEBSITE' ) ) define( 'TC_WEBSITE' , $tc_base_data['authoruri'] ); //this is the structure of the Customizr code : groups => ('path' , 'class_suffix') $this -> tc_core = apply_filters( 'tc_core', array( 'fire' => array( array('inc' , 'init'),//defines default values (layout, socials, default slider...) and theme supports (after_setup_theme) array('inc' , 'plugins_compat'),//handles various plugins compatibilty (Jetpack, Bbpress, Qtranslate, Woocommerce, The Event Calendar ...) array('inc' , 'utils_settings_map'),//customizer setting map array('inc' , 'utils'),//helpers used everywhere array('inc' , 'resources'),//loads front stylesheets (skins) and javascripts array('inc' , 'widgets'),//widget factory array('inc/admin' , 'admin_init'),//loads admin style and javascript ressources. Handles various pure admin actions (no customizer actions) array('inc/admin' , 'admin_page')//creates the welcome/help panel including changelog and system config ), 'admin' => array( array('inc/admin' , 'customize'),//loads customizer actions and resources array('inc/admin' , 'meta_boxes')//loads the meta boxes for pages, posts and attachment : slider and layout settings ), //the following files/classes define the action hooks for front end rendering : header, main content, footer 'header' => array( array('inc/parts' , 'header_main'), array('inc/parts' , 'menu'), array('inc/parts' , 'nav_walker') ), 'content' => array( array('inc/parts', '404'), array('inc/parts', 'attachment'), array('inc/parts', 'breadcrumb'), array('inc/parts', 'comments'), array('inc/parts', 'featured_pages'), array('inc/parts', 'gallery'), array('inc/parts', 'headings'), array('inc/parts', 'no_results'), array('inc/parts', 'page'), array('inc/parts', 'post_thumbnails'), array('inc/parts', 'post'), array('inc/parts', 'post_list'), array('inc/parts', 'post_list_grid'), array('inc/parts', 'post_metas'), array('inc/parts', 'post_navigation'), array('inc/parts', 'sidebar'), array('inc/parts', 'slider') ), 'footer' => array( array('inc/parts', 'footer_main'), ), 'addons' => apply_filters( 'tc_addons_classes' , array() ) )//end of array );//end of filter //check the context if ( file_exists( sprintf( '%sinc/init-pro.php' , TC_BASE ) ) && 'customizr-pro' == self::$theme_name ) require_once( sprintf( '%sinc/init-pro.php' , TC_BASE ) ); self::$tc_option_group = 'tc_theme_options'; //set files to load according to the context : admin / front / customize add_filter( 'tc_get_files_to_load' , array( $this , 'tc_set_files_to_load' ) ); //theme class groups instanciation $this -> tc__(); }//end of __construct()