Beispiel #1
0
 public static function frontend_css()
 {
     if (!self::is_page()) {
         return false;
     }
     wp_enqueue_style(__CLASS__, theme_features::get_theme_addons_css(__DIR__), 'frontend', theme_file_timestamp::get_timestamp());
 }
 /**
  * CSS
  */
 public static function frontend_enqueue_css()
 {
     $css = ['frontend' => ['deps' => ['awesome'], 'url' => theme_features::get_theme_css('frontend/frontend')], 'awesome' => ['deps' => [], 'url' => 'http://cdn.bootcss.com/font-awesome/4.4.0/css/font-awesome.min.css', 'version' => null]];
     foreach ($css as $k => $v) {
         wp_enqueue_style($k, $v['url'], isset($v['deps']) ? $v['deps'] : [], self::get_version($v));
     }
 }
 public static function frontend_seajs_alias(array $alias = [])
 {
     $datas = apply_filters('js_cache_request', []);
     $datas['action'] = self::$iden;
     $alias[self::$iden] = theme_features::get_process_url($datas);
     return $alias;
 }
 public static function frontend_seajs_alias(array $alias = [])
 {
     if (self::is_enabled() && theme_cache::is_singular()) {
         $alias[self::$iden] = theme_features::get_theme_addons_js(__DIR__);
     }
     return $alias;
 }
Beispiel #5
0
 /**
  * frontend css
  */
 public static function frontend_enqueue_css()
 {
     $frontend_css = theme_cache::is_user_logged_in() ? 'frontend-logged' : 'frontend';
     $css = ['frontend' => ['deps' => ['awesome'], 'url' => theme_features::get_theme_css($frontend_css)], 'awesome' => ['deps' => [], 'url' => '//cdn.bootcss.com/font-awesome/4.4.0/css/font-awesome.min.css', 'version' => null]];
     foreach ($css as $k => $v) {
         wp_enqueue_style($k, $v['url'], isset($v['deps']) ? $v['deps'] : [], self::get_version($v));
     }
 }
Beispiel #6
0
 public static function display($args = [])
 {
     global $post;
     $opt = self::get_options();
     $img_url = theme_features::get_thumbnail_src($post->ID);
     $defaults = array('post_title_text' => theme_cache::get_the_title($post->ID), 'post_url' => theme_cache::get_permalink($post->ID), 'blog_name' => theme_cache::get_bloginfo('name'), 'blog_url' => theme_cache::home_url(), 'img_url' => esc_url($img_url), 'post_excerpt' => esc_attr(mb_substr(html_minify(strip_tags(get_the_excerpt())), 0, 120)), 'post_content' => esc_attr(mb_substr(html_minify(strip_tags(get_the_content())), 0, 120)), 'author' => theme_cache::get_the_author_meta('display_name', $post->post_author));
     $output_keywords = array_merge($defaults, $args);
     $tpl_keywords = array('%post_title_text%', '%post_url%', '%blog_name%', '%blog_url%', '%img_url%', '%post_excerpt%', '%post_content%', '%author%');
     $post_share_code = stripslashes(str_ireplace($tpl_keywords, $output_keywords, $opt['code']));
     echo $post_share_code;
 }
 public static function init()
 {
     $default_headers = [];
     $img_names = array('banner-01.png');
     $args = array('default-text-color' => 'fff', 'default-image' => theme_features::get_theme_addons_image(__DIR__, $img_names[0]), 'wp-head-callback' => __CLASS__ . '::header_style', 'admin-head-callback' => __CLASS__ . '::admin_header_style', 'admin-preview-callback' => __CLASS__ . '::admin_header_image', 'random-default' => true);
     foreach ($img_names as $img_name) {
         $basename = explode('.', $img_name);
         $default_headers[$img_name] = array('url' => theme_features::get_theme_addons_image(__DIR__, $img_name), 'thumbnail_url' => theme_features::get_theme_addons_image(__DIR__, $basename[0] . '-thumbnail.' . $basename[1]));
     }
     add_theme_support('custom-header', $args);
     register_default_headers($default_headers);
 }
 function admin_enqueues($hook_suffix)
 {
     if ($hook_suffix != $this->menu_id) {
         return;
     }
     // WordPress 3.1 vs older version compatibility
     if (wp_script_is('jquery-ui-widget', 'registered')) {
         wp_enqueue_script('jquery-ui-progressbar', theme_features::get_theme_addons_js(__FILE__, 'jquery-ui/jquery.ui.progressbar.min'), array('jquery-ui-core', 'jquery-ui-widget'), '1.8.6');
     } else {
         wp_enqueue_script('jquery-ui-progressbar', theme_features::get_theme_addons_js(__DIR__, 'jquery-ui/jquery.ui.progressbar.min.1.7.2'), array('jquery-ui-core'), '1.7.2');
     }
     wp_enqueue_style('jquery-ui-regenthumbs', theme_features::get_theme_addons_css(__DIR__, 'jquery-ui-1.7.2.custom'), [], '1.7.2');
 }
    public static function display_backend()
    {
        ?>
		<fieldset>
			<legend><?php 
        echo ___('File timestamp');
        ?>
</legend>
			<p class="description"><?php 
        echo ___('All theme js, css and images static files are output with timestamp, you can refresh these files after theme updates or when you want.');
        ?>
</p>
			<table class="form-table">
				<tbody>
					<tr>
						<th><?php 
        echo ___('Control');
        ?>
</th>
						<td>
							<?php 
        if (isset($_GET[self::$iden])) {
            echo status_tip('success', ___('The file timestamp has been refresh.'));
        }
        ?>
							<a href="<?php 
        echo esc_url(theme_features::get_process_url(['action' => self::$iden]));
        ?>
" class="button button-primary"><?php 
        echo ___('Refresh now');
        ?>
</a>
							<span class="description"><i class="fa fa-warning"></i> <?php 
        echo ___('Save your settings before click');
        ?>
</span>

							<input type="hidden" name="<?php 
        echo self::$iden;
        ?>
" value="<?php 
        echo self::get_timestamp();
        ?>
">
						</td>
					</tr>
				</tbody>
			</table>
		</fieldset>
		<?php 
    }
Beispiel #10
0
 public static function frontend_js_config(array $config)
 {
     if (!self::is_enabled()) {
         return $config;
     }
     global $post, $page, $numpages;
     if ($page < 1) {
         $page = 1;
     }
     if ($page > $numpages) {
         $page = $numpages;
     }
     $config[__CLASS__] = ['process_url' => theme_features::get_process_url(['action' => __CLASS__, 'post-id' => $post->ID]), 'post_id' => $post->ID, 'numpages' => $numpages, 'page' => $page, 'url_tpl' => theme_features::get_link_page_url(9999), 'lang' => ['M02' => ___('Content loaded.'), 'M03' => ___('Already first page.'), 'M04' => ___('Already last page.'), 'E01' => ___('Sorry, server is busy now, can not respond your request, please try again later.')]];
     return $config;
 }
 public static function get_count($key, $user_id)
 {
     $cache_id = 'user-count-' . $user_id;
     $caches = (array) wp_cache_get($cache_id);
     switch ($key) {
         case 'works':
             if (!isset($caches['works'])) {
                 $caches['works'] = (int) count_user_posts($user_id);
                 wp_cache_set($cache_id, $caches, null, self::$cache_expire);
             }
             return $caches['works'];
         case 'comments':
             if (!isset($caches['comments'])) {
                 $caches['comments'] = (int) theme_features::get_user_comments_count($user_id);
                 wp_cache_set($cache_id, $caches, null, self::$cache_expire);
             }
             return $caches['comments'];
         case 'followers_count':
             return (int) get_user_meta($user_id, self::$user_meta_key['followers_count'], true);
         case 'following_count':
             return (int) get_user_meta($user_id, self::$user_meta_key['following_count'], true);
     }
 }
Beispiel #12
0
 public static function frontend_js_config(array $config)
 {
     if (!self::is_page()) {
         return $config;
     }
     $config[__CLASS__] = ['process_url' => theme_features::get_process_url(array('action' => __CLASS__)), 'lang' => ['M01' => ___('Target locking...'), 'M02' => ___('Bombing, please wait...')]];
     return $config;
 }
    /**
     * show the options settings for admin theme setting page.
     * 
     * @return string html string for options
     * @version 3.2.0
     * 
     */
    public static function display_backend()
    {
        ?>
		<div class="wrap">
			<?php 
        if (isset($_GET['updated'])) {
            ?>
				<div id="settings-updated">
					<?php 
            echo status_tip('success', ___('Your settings were saved successfully.'));
            ?>
				</div>
			<?php 
        }
        ?>
			<form id="backend-options-frm" method="post" action="<?php 
        echo theme_features::get_process_url(['action' => __CLASS__]);
        ?>
">
				
				<div class="backend-tab-loading"><?php 
        echo status_tip('loading', ___('Loading your settings, please wait...'));
        ?>
</div>
				
				<div id="backend-tab" class="backend-tab">
					<nav class="tab-header">

						<a href="<?php 
        echo theme_functions::theme_meta_translate()['theme_url'];
        ?>
" target="_blank" title="<?php 
        echo ___('Visit the official of theme');
        ?>
" class="tab-title">
							<?php 
        echo theme_functions::theme_meta_translate()['name'];
        ?>
						</a>
					
						<span class="tab-item" title="<?php 
        echo ___('The theme common basic settings.');
        ?>
">
							<i class="fa fa-fw fa-cog"></i> 
							<span class="tx"><?php 
        echo ___('Basic settings');
        ?>
</span>
						</span><!-- basic settings -->
						
						<span class="tab-item" title="<?php 
        echo ___('You can customize the theme in this label.');
        ?>
">
							<i class="fa fa-fw fa-paint-brush"></i> 
							<span class="tx"><?php 
        echo ___('Page settings');
        ?>
</span>
						</span><!-- page settings -->
						
						<span class="tab-item" title="<?php 
        echo ___('If the theme there are some problems, you can try to use these settings.');
        ?>
">
							<i class="fa fa-fw fa-cogs"></i> 
							<span class="tx"><?php 
        echo ___('Advanced settings');
        ?>
</span>
						</span><!-- advanced settings -->
						
						<span class="tab-item" title="<?php 
        echo ___('This settings is for developer, if you want to debug code, you can try this.');
        ?>
">
							<i class="fa fa-fw fa-code"></i> 
							<span class="tx"><?php 
        echo ___('Developer settings');
        ?>
</span>
						</span><!-- developer mode -->
						
						<span class="tab-item" title="<?php 
        echo ___('If you in trouble, maybe this label can help you.');
        ?>
">
							<i class="fa fa-fw fa-question-circle"></i> 
							<span class="tx"><?php 
        echo ___('About &amp; help');
        ?>
</span>
						</span><!-- about and help -->
						
					</nav>

					
					<div class="tab-body">
						<div class="tab-item">
							<?php 
        do_action('base_settings');
        ?>
						</div><!-- BASE SETTINGS -->
					
						<div class="tab-item">
							<?php 
        do_action('page_settings');
        ?>
						</div><!-- PAGE SETTINGS -->
					
						<div class="tab-item">
							<?php 
        do_action('advanced_settings');
        ?>
						</div><!-- ADVANCED SETTINGS -->
					
						<div class="tab-item">
							<?php 
        do_action('dev_settings');
        ?>
						</div><!-- DEVELOPER SETTINGS -->
					
						<div class="tab-item">
							<?php 
        do_action('help_settings');
        ?>
						</div><!-- ABOUT and HELP -->
					</div><!-- tab-content -->
				</div><!-- backend-tab -->
		
				<p>
					<input type="hidden" name="<?php 
        echo __CLASS__;
        ?>
[nonce]" value="<?php 
        echo wp_create_nonce(__CLASS__);
        ?>
">
					
					<button id="submit" type="submit" class="button button-primary button-large"><i class="fa fa-check"></i> <span class="tx"><?php 
        echo ___('Save all settings');
        ?>
</span></button>
					
					<label for="options-restore" class="label-options-restore" title="<?php 
        echo ___('Something error with theme? Try to restore. Be careful, theme options will be cleared up!');
        ?>
">
						<input id="options-restore" name="<?php 
        echo __CLASS__;
        ?>
[restore]" type="checkbox" value="1"/>
						<?php 
        echo ___('Restore to theme default options');
        ?>
 <i class="fa fa-question-circle"></i>
					</label>
				</p>
			</form>
		</div>
		<?php 
    }
Beispiel #14
0
    public static function display_backend()
    {
        $options = self::get_options();
        $url = isset($options['url']) ? stripslashes($options['url']) : null;
        ?>
		<!-- maintenance_mode -->
		<fieldset>
			<legend><i class="fa fa-fw fa-wrench"></i> <?php 
        echo ___('Maintenance Mode');
        ?>
</legend>
			<p class="description"><?php 
        echo ___('If your site needs to test privately, maybe fill a URL in the redirect area that the the visitors will see the redirect page but yourself, otherwise left blank.');
        ?>
</p>
			<p class="description"><strong><?php 
        echo ___('Attention: if theme has frontend log-in page, please DO NOT use maintenance mode, or you can not log-in to background.');
        ?>
</strong></p>
			<table class="form-table">
				<tbody>
					<tr>
						<th scope="row"><label for="<?php 
        echo self::$iden;
        ?>
-url"><?php 
        echo ___('Redirect URL (include http://):');
        ?>
</label></th>
						<td>
							<input type="url" id="<?php 
        echo self::$iden;
        ?>
-url" name="<?php 
        echo self::$iden;
        ?>
[url]" class="widefat" value="<?php 
        echo $url;
        ?>
"/>
							
							<p class="description">
								<?php 
        echo ___('Optional template URL: ');
        ?>
							
								<input type="url" class="widfat text-select" value="<?php 
        echo theme_features::get_process_url(array('action' => self::$iden));
        ?>
" readonly />
							</p>
						</td>
					</tr>
				</tbody>
			</table>
		</fieldset>
	<?php 
    }
Beispiel #15
0
     */
    public static function get_comment_pages_count($comments)
    {
        static $count = null;
        if ($count === null) {
            $count = get_comment_pages_count($comments, theme_cache::get_option('comments_per_page'), theme_cache::get_option('thread_comments'));
        }
        return $count;
    }
    /**
     * Get all cat ID by children cat id
     *
     * @param int $cat_id Current children cat id
     * @param array &$all_cat_id All cats id
     * @return 
     * @version 1.0.0
     */
    public static function get_all_cats_by_child($cat_id, array &$all_cat_id)
    {
        $cat = theme_cache::get_category($cat_id);
        if (!$cat) {
            return false;
        }
        $all_cat_id[] = $cat_id;
        if ($cat->parent != 0) {
            return self::get_all_cats_by_child(get_category($cat->parent)->term_id, $all_cat_id);
        }
    }
}
theme_features::init();
Beispiel #16
0
 public static function template_include($template)
 {
     if (!self::is_enabled() || self::get_cat_id() <= 0) {
         return $template;
     }
     if (theme_cache::is_category() && theme_features::get_cat_root_id() == self::get_cat_id()) {
         return self::get_tpl_include('category');
     } else {
         if (theme_cache::is_singular('post') && theme_features::get_cat_root_id() == self::get_cat_id()) {
             return self::get_tpl_include('post');
         }
     }
     return $template;
 }
?>
		</h2>
	</div>
	
	<ul id="comment-list-<?php 
echo $post->ID;
?>
" class="comment-list">
		<li class="comment media comment-loading">
			<div class="page-tip"><?php 
echo status_tip('loading', ___('Loading, please wait...'));
?>
</div>
		</li>
	</ul>
	
	<?php 
if (theme_features::get_comment_pages_count($wp_query->comments) > 1) {
    ?>
		<div id="comment-pagination-container"></div>
	<?php 
}
?>

	<a href="#respond" class="btn btn-success btn-lg btn-block"><i class="fa fa-edit"></i> <?php 
echo ___('Write a comment');
?>
</a>
</div><!-- /.comment-wrapper -->

 public static function backend_css()
 {
     wp_register_style(__CLASS__ . '-backend', theme_features::get_theme_addons_css(__DIR__, 'backend'), false, theme_file_timestamp::get_timestamp());
     wp_enqueue_style(__CLASS__ . '-backend');
 }
 public static function cache_request(array $output = [])
 {
     if (isset($_GET[self::$iden]) && is_array($_GET[self::$iden])) {
         $get = $_GET[self::$iden];
         $post_id = isset($get['post-id']) && is_string($get['post-id']) ? (int) $get['post-id'] : null;
         $type = isset($get['type']) && is_string($get['type']) ? $get['type'] : null;
         switch ($type) {
             case 'get-comments':
                 if (!$post_id) {
                     return $output;
                 }
                 $post = theme_cache::get_post($post_id);
                 $pages = theme_features::get_comment_pages_count(self::get_comments(['post_id' => $post->ID]));
                 /**
                  * cpage
                  */
                 if (isset($get['capge']) && is_numeric($get['capge'])) {
                     $cpage = (int) $get['capge'];
                 } else {
                     $cpage = theme_cache::get_option('default_comments_page') == 'newest' ? $pages : 1;
                 }
                 if (!theme_cache::is_user_logged_in()) {
                     $commenter = wp_get_current_commenter();
                     $user_name = $commenter['comment_author'];
                     $user_url = $commenter['comment_author_url'];
                     $avatar_url = theme_cache::get_avatar_url($commenter['comment_author_email']);
                     $user_email = $commenter['comment_author_email'];
                 } else {
                     global $current_user;
                     get_currentuserinfo();
                     $user_name = $current_user->display_name;
                     $user_url = theme_cache::get_author_posts_url($current_user->ID);
                     $avatar_url = theme_cache::get_avatar_url($current_user->ID);
                 }
                 $output[self::$iden] = ['comments' => self::get_comments_list($post_id, $cpage), 'count' => $post ? $post->comment_count : 0, 'pages' => $pages, 'cpage' => $cpage, 'logged' => theme_cache::is_user_logged_in(), 'registration' => theme_cache::get_option('comment_registration'), 'user-name' => esc_html($user_name), 'user-url' => esc_url($user_url), 'avatar-url' => $avatar_url];
                 if (isset($user_email)) {
                     $output[self::$iden]['user-email'] = $user_email;
                 }
                 break;
         }
     }
     return $output;
 }
 /**
  * process
  */
 public static function process()
 {
     if (!theme_cache::current_user_can('manage_options')) {
         return false;
     }
     @ini_set('max_input_nesting_level', '10000');
     @ini_set('max_execution_time', 0);
     remove_dir(theme_features::get_stylesheet_directory() . theme_features::$basedir_js_min);
     theme_features::minify_force(theme_features::get_stylesheet_directory() . theme_features::$basedir_js_src);
     remove_dir(theme_features::get_stylesheet_directory() . theme_features::$basedir_css_min);
     theme_features::minify_force(theme_features::get_stylesheet_directory() . theme_features::$basedir_css_src);
     theme_features::minify_force(theme_features::get_stylesheet_directory() . theme_features::$basedir_addons);
     theme_file_timestamp::set_timestamp();
     wp_redirect(add_query_arg(__CLASS__, 1, theme_options::get_url()));
     die;
 }
Beispiel #21
0
echo (int) $author_posts_count !== 0 ? $author_posts_count : '-';
?>
					</a></td>
				</tr>
				<tr>
					<th><?php 
echo ___('Comments');
?>
</th>
					<td>
						<a href="<?php 
echo theme_custom_author_profile::get_tabs('comments', $author)['url'];
?>
">
						<?php 
$count_comments = theme_features::get_user_comments_count($author);
echo (int) $count_comments != 0 ? $count_comments : '-';
?>
						</a>
					</td>
				</tr>
				<?php 
if (class_exists('theme_custom_point')) {
    ?>
					<tr>
						<th><?php 
    echo theme_custom_point::get_point_name();
    ?>
</th>
						<td>
							<?php 
Beispiel #22
0
 public static function backend_js_config(array $config)
 {
     $config[__CLASS__] = ['process_url' => theme_features::get_process_url(['action' => __CLASS__, 'type' => 'test'])];
     return $config;
 }
Beispiel #23
0
    public static function js()
    {
        ?>
		seajs.use('<?php 
        echo theme_features::get_theme_addons_js(__DIR__);
        ?>
',function(m){
			/** alipay */
			m.alipay.config.lang.M00001 = '<?php 
        echo esc_js(sprintf(___('Donate to INN STUDIO (%s)'), theme_features::get_theme_info('name')));
        ?>
';
			m.alipay.config.lang.M00002 = '<?php 
        echo esc_js(___('Message for INN STUDIO:'));
        ?>
';
			
			/** paypal */
			m.paypal.config.lang.M00001 = '<?php 
        echo esc_js(sprintf(___('Donate to INN STUDIO (%s)'), theme_features::get_theme_info('name')));
        ?>
';
			

			m.init();
		});
		<?php 
    }
Beispiel #24
0
 public static function frontend_enqueue_scripts()
 {
     $data = apply_filters('dynamic_request', []);
     $data['action'] = __CLASS__;
     wp_enqueue_script(__CLASS__, theme_features::get_process_url($data), [], theme_file_timestamp::get_timestamp(), true);
 }
Beispiel #25
0
 public static function frontend_css()
 {
     if (!self::is_page()) {
         return false;
     }
     $tabs = self::get_tabs();
     $tab_active = get_query_var('tab');
     switch ($tab_active) {
         case 'avatar':
             wp_enqueue_style(__CLASS__ . '-' . $tab_active, theme_features::get_theme_addons_css(__DIR__, $tab_active), 'frontend', theme_file_timestamp::get_timestamp());
             wp_enqueue_style(__CLASS__ . '-cropper', theme_features::get_theme_addons_css(__DIR__, 'cropper'), 'frontend', theme_file_timestamp::get_timestamp());
             break;
     }
 }
 public static function frontend_seajs_alias(array $alias = [])
 {
     if (!theme_cache::is_singular('post')) {
         return $alias;
     }
     $alias[__CLASS__] = theme_features::get_theme_addons_js(__DIR__);
     return $alias;
 }
Beispiel #27
0
 /**
  * get_page_pagenavi
  * 
  * 
  * @return 
  * @version 1.0.0
  * 
  */
 public static function get_page_pagenavi()
 {
     // var_dump( theme_features::get_pagination());
     global $page, $numpages;
     $output = null;
     if ($numpages < 2) {
         return;
     }
     if ($page < $numpages) {
         $next_page = $page + 1;
         $output = '<a href="' . theme_features::get_link_page_url($next_page) . '" class="next_page">' . ___('Next page') . '</a>';
     } else {
         $prev_page = $page - 1;
         $output = '<a href="' . theme_features::get_link_page_url($prev_page) . '" class="prev_page">' . ___('Previous page') . '</a>';
     }
     $output = $output ? '<div class="singular_page">' . $output . '</div>' : null;
     $args = array('range' => 3);
     $output .= theme_features::get_pagination($args);
     return $output;
 }
Beispiel #28
0
 public static function frontend_css()
 {
     if (!theme_cache::is_singular('post') || !self::is_enabled()) {
         return false;
     }
     wp_enqueue_style(__CLASS__, theme_features::get_theme_addons_css(__DIR__), 'frontend', theme_file_timestamp::get_timestamp());
 }
 public static function frontend_seajs_alias(array $alias = [])
 {
     if (self::can_show()) {
         $alias[__CLASS__] = theme_features::get_theme_addons_js(__DIR__);
     }
     return $alias;
 }
Beispiel #30
-1
 public static function frontend_js_config(array $config)
 {
     if (!theme_cache::is_singular('post')) {
         return $config;
     }
     $config[__CLASS__] = ['process_url' => theme_features::get_process_url(['action' => __CLASS__, 'type' => 'incr'])];
     return $config;
 }