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 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 }
/** * Admin Display */ public static function display_backend() { ?> <!-- theme_min_rebuild --> <fieldset> <legend><?php echo ___('Rebuild minify version'); ?> </legend> <p class="description"><?php echo ___('Rebuild the minify version file of JS and CSS. If you have edit JS or CSS file, please run it. May take several minutes.'); ?> </p> <table class="form-table"> <tbody> <tr> <th scope="row"><?php echo ___('Control'); ?> </th> <td> <?php if (isset($_GET[__CLASS__])) { echo status_tip('success', ___('Files have been rebuilt.')); } ?> <p> <a href="<?php echo theme_features::get_process_url(['action' => __CLASS__]); ?> " class="button button-primary" onclick="javascript:this.innerHTML='<?php echo ___('Rebuilding, please wait...'); ?> '"><?php echo ___('Start rebuild'); ?> </a> <span class="description"><i class="fa fa-exclamation-circle"></i> <?php echo ___('Save your settings before rebuild'); ?> </span> </p> </td> </tr> </tbody> </table> </fieldset> <?php }
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 frontend_js_config(array $config) { if (!self::is_page()) { return $config; } $config[__CLASS__] = ['process_url' => theme_features::get_process_url(['action' => __CLASS__])]; 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 & 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 }
public static function frontend_seajs_use() { if (!self::can_comment()) { return false; } global $post; ?> seajs.use('<?php echo self::$iden; ?> ',function(m){ m.config.pagi_process_url = '<?php echo theme_features::get_process_url(['action' => self::$iden, 'type' => 'get-comments', 'post-id' => $post->ID, 'cpage' => 'n']); ?> '; m.config.process_url = '<?php echo theme_features::get_process_url(['action' => self::$iden]); ?> '; m.config.post_id = <?php echo $post->ID; ?> ; m.config.lang.M01 = '<?php echo ___('Loading, please wait...'); ?> '; m.config.lang.M02 = '<?php echo ___('Commented successfully, thank you!'); ?> '; m.config.lang.M03 = '<i class="fa fa-arrow-left"></i>'; m.config.lang.M04 = '<i class="fa fa-arrow-right"></i>'; m.config.lang.M05 = '<?php echo ___('{n} page'); ?> '; m.config.lang.E01 = '<?php echo ___('Sorry, server is busy now, can not respond your request, please try again later.'); ?> '; m.init(); }); <?php }
public static function process() { $output = []; /** * nonce */ $nonce = theme_features::create_nonce(); /** * sign-type */ $sign_type = isset($_REQUEST['sign-type']) ? $_REQUEST['sign-type'] : null; $opt = self::get_options(); switch ($sign_type) { /** * sina */ case 'weibo': case 'sina': $url = urlencode(theme_features::get_process_url(array('action' => 'isos_cb', 'sina' => 'set-auth', 'uri' => isset($_SERVER["HTTP_REFERER"]) && strpos($_SERVER['HTTP_REFERER'], theme_cache::home_url()) === 0 ? $_SERVER["HTTP_REFERER"] : home_url(), 'nonce' => $nonce))); $url = add_query_arg(array('sina' => 'get-auth', 'akey' => base64_encode(authcode(self::get_sina_config('akey'), 'encode')), 'skey' => base64_encode(authcode(self::get_sina_config('skey'), 'encode')), 'uri' => $url, 'state' => $nonce), self::$open_url); header('Location: ' . $url); die(___('Redirecting, please wait...')); /** * qq */ /** * qq */ case 'qq': include __DIR__ . '/inc/qq/qqConnectAPI.php'; $qc = new theme_open_sign\inc\qq\QC(self::get_qc_config()); //var_dump($qc);exit; /** go to login page */ $qc->qq_login(); die(___('Redirecting, please wait...')); default: } die(theme_features::json_format($output)); }
private static function get_process_url($type) { return esc_url(add_query_arg(array('action' => __CLASS__, 'type' => $type), theme_features::get_process_url())); }
public static function backend_js_config(array $config) { $config[__CLASS__] = ['process_url' => theme_features::get_process_url(['action' => __CLASS__, 'type' => 'test'])]; return $config; }
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); }
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__)), 'default_size' => self::$thumbnail_size, 'lang' => ['M01' => ___('Loading, please wait...'), 'M02' => ___('Uploading {0}/{1}, please wait...'), 'M03' => ___('Click to delete'), 'M04' => ___('{0} files have been uploaded, please insert to post content on demand.'), 'M05' => ___('Source'), 'M06' => ___('Click to view source'), 'M07' => ___('Set as cover.'), 'M08' => ___('Optional, some description'), 'M09' => ___('Insert to content'), 'M10' => ___('Preview'), 'M11' => ___('Large size'), 'M12' => ___('Medium size'), 'M13' => ___('Small size'), 'E01' => ___('Sorry, server is busy now, can not respond your request, please try again later.')], 'auto_save' => ['lang' => ['M01' => ___('You have a auto save version, do you want to restore? Auto save last time is {time}.'), 'M02' => ___('Restore post data completed, please check it.'), 'M03' => ___('The post data has saved your browser.')]]]; if (self::is_edit()) { $thumbnail_id = (int) get_post_thumbnail_id(self::is_edit()); $attachs = []; $attachs_data = self::get_post_attachs(self::is_edit()); foreach ($attachs_data as $v) { $attachs[$v->ID] = self::get_thumbnail_data($v->ID); $attachs[$v->ID]['attach-id'] = $v->ID; } unset($attachs_data); $config[__CLASS__]['edit'] = 1; $config[__CLASS__]['thumbnail_id'] = $thumbnail_id; $config[__CLASS__]['attachs'] = $attachs; } else { $config[__CLASS__]['lang']['M14'] = ___('Please select a category'); //$config[__CLASS__]['cats'] = self::get_order_cats(); $config[__CLASS__]['cats'] = self::get_cats(); } return $config; }
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; }
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__)), 'min_posts' => self::get_posts_number('min'), 'max_posts' => self::get_posts_number('max'), 'tpl_input' => self::get_input_tpl('%placeholder%'), 'tpl_preview' => self::get_list_tpl(['preview' => true]), 'lang' => ['M01' => ___('Loading, please wait...'), 'M02' => ___('A item has been deleted.'), 'M03' => ___('Getting post data, please wait...'), 'M04' => ___('Previewing, please wait...'), 'E01' => ___('Sorry, server is busy now, can not respond your request, please try again later.'), 'E02' => sprintf(___('Sorry, the minimum number of posts is %d.'), self::get_posts_number('min')), 'E03' => sprintf(___('Sorry, the maximum number of posts is %d.'), self::get_posts_number('max')), 'E04' => ___('Sorry, the post id must be number, please correct it.')]]; return $config; }
public static function frontend_js_config() { if (theme_cache::is_user_logged_in() || !theme_cache::is_page(self::$page_slug)) { return false; } ?> seajs.use('<?php echo self::$iden; ?> ',function(m){ m.config.process_url = '<?php echo theme_features::get_process_url(array('action' => theme_quick_sign::$iden)); ?> '; m.config.lang.M00001 = '<?php echo esc_js(___('Loading, please wait...')); ?> '; m.config.lang.E00001 = '<?php echo esc_js(___('Sorry, server is busy now, can not respond your request, please try again later.')); ?> '; m.init(); }); <?php }
public static function backend_seajs_use() { ?> seajs.use('<?php echo __CLASS__; ?> ',function(m){ m.config.process_url = '<?php echo theme_features::get_process_url(array('action' => __CLASS__)); ?> '; m.config.lang.M00001 = '<?php echo ___('Loading, please wait...'); ?> '; m.config.lang.E00001 = '<?php echo ___('Server error or network is disconnected.'); ?> '; m.init(); }); <?php }
public static function backend_seajs_use() { ?> seajs.use('<?php echo self::$iden; ?> ',function(m){ m.config.process_url = '<?php echo esc_url(theme_features::get_process_url(['action' => self::$iden])); ?> '; m.config.lang.M01 = '<?php echo ___('Loading, please wait...'); ?> '; m.config.lang.E01 = '<?php echo ___('Sorry, server error please try again later.'); ?> '; m.init(); }); <?php }
public static function backend_seajs_use() { ?> seajs.use('<?php echo self::$iden; ?> ',function(m){ m.config.process_url = '<?php echo theme_features::get_process_url(['action' => self::$iden, 'type' => 'test']); ?> '; m.config.lang.M01 = '<?php echo ___('Loading, please wait...'); ?> '; m.config.lang.E01 = '<?php echo ___('Server error or network is disconnected.'); ?> '; m.init(); }); <?php }
public static function backend_seajs_use() { ?> seajs.use('<?php echo __CLASS__; ?> ',function(m){ m.config.lang.M00001 = '<?php echo ___('Processing, please wait...'); ?> '; m.config.lang.M00002 = '<?php echo ___('Error: Your browser does not support HTML5. '); ?> '; m.config.lang.E00001 = '<?php echo ___('Error: failed to complete the operation. '); ?> '; m.config.lang.E00002 = '<?php echo ___('Error: Not match file. '); ?> '; m.config.process_url = '<?php echo theme_features::get_process_url(['action' => __CLASS__]); ?> '; m.init(); }); <?php }
public static function frontend_js_config(array $config) { if (!self::is_page()) { return $config; } $config[__CLASS__] = ['process_url' => theme_features::get_process_url(['action' => __CLASS__]), 'lang' => ['M01' => ___('Loading, please wait...'), 'M02' => ___('Enter to send P.M.'), 'M03' => ___('P.M. content'), 'M04' => ___('Send P.M.'), 'M05' => ___('Hello, I am %name%, welcome to chat with me what do you want.'), 'M06' => ___('P.M. is sending, please wait...'), 'M07' => ___('Me'), 'E01' => ___('Sorry, server is busy now, can not respond your request, please try again later.')], 'my_uid' => self::get_niceid(theme_cache::get_current_user_id()), 'userdata' => ['me' => ['name' => ___('Me'), 'url' => theme_cache::get_author_posts_url(theme_cache::get_current_user_id())]]]; return $config; }
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 }
public static function display_backend() { ?> <fieldset> <legend><i class="fa fa-fw fa-cloud-download"></i> <?php echo ___('Storage settings'); ?> </legend> <p class="description"><?php echo ___('You can edit storage types here. They will display in contribution page.'); ?> </p> <table class="form-table"> <tbody> <tr> <th><label for="<?php echo __CLASS__; ?> -enabled"><?php echo ___('Enable or not?'); ?> </label></th> <td> <select name="<?php echo __CLASS__; ?> [enabled]" id="<?php echo __CLASS__; ?> -enabled" class="widefat"> <?php the_option_list(-1, ___('Disable'), self::get_options('enabled')); ?> <?php the_option_list(1, ___('Enable'), self::get_options('enabled')); ?> </select> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -enabled-display-name"><?php echo ___('Enable download item name?'); ?> </label></th> <td> <select name="<?php echo __CLASS__; ?> [enabled-display-name]" id="<?php echo __CLASS__; ?> -enabled-display-name" class="widefat"> <?php the_option_list(-1, ___('Disable'), self::get_options('enabled-display-name')); ?> <?php the_option_list(1, ___('Enable'), self::get_options('enabled-display-name')); ?> </select> </td> </tr> <tr> <th><?php echo ___('Control'); ?> </th> <td> <a class="button button-primary" target="_blank" href="<?php echo theme_features::get_process_url(['action' => __CLASS__, 'type' => 'meta-convert']); ?> "><i class="fa fa-exchange"></i> <?php echo ___('Convert to new version data'); ?> </a> <span class="description"><?php echo ___('This operation only needs to be performed once if you are upgrade from a old version.'); ?> </span> </td> </tr> </tbody> </table> </fieldset> <?php }
public static function frontend_js_config(array $config) { if (!self::can_comment()) { return $config; } global $post; /** config */ $config[__CLASS__] = ['pagi_process_url' => theme_features::get_process_url(['action' => __CLASS__, 'type' => 'get-comments', 'post-id' => $post->ID, 'cpage' => 'n']), 'process_url' => theme_features::get_process_url(['action' => __CLASS__]), 'post_id' => $post->ID, 'lang' => ['M01' => self::get_options('lang-loading'), 'M02' => '<i class="fa fa-arrow-left"></i>', 'M03' => '<i class="fa fa-arrow-right"></i>', 'M04' => ___('{n} page')]]; return $config; }
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; }