public static function display_backend() { ?> <fieldset> <legend><i class="fa fa-fw fa-newspaper-o"></i> <?php echo ___('Graphic text mode settings'); ?> </legend> <p class="description"><?php echo ___('Graphic text mode is a different with normal card list mode. It is mixed list with graphic and text.'); ?> </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__; ?> -cat-id"><?php echo ___('Which category using?'); ?> </label></th> <td> <?php theme_features::cat_option_list(__CLASS__, 'cat-id'); ?> </td> </tr> </tbody> </table> </fieldset> <?php }
public static function display_backend() { $opt = (array) self::get_options(); ?> <fieldset> <legend><i class="fa fa-fw fa-external-link"></i> <?php echo ___('Global link target settings'); ?> </legend> <p class="description"><?php echo ___('You can settings global link target here.'); ?> </p> <table class="form-table"> <tbody> <tr> <th><label for="<?php echo __CLASS__; ?> -target"><?php echo ___('Global target'); ?> </label></th> <td> <select name="<?php echo __CLASS__; ?> [target]" id="<?php echo __CLASS__; ?> -target" class="widefat"> <?php the_option_list('_blank', ___('Open in new window'), self::get_options('target')); ?> <?php the_option_list('_self', ___('Open in current window'), self::get_options('target')); ?> </select> </td> </tr> </tbody> </table> </fieldset> <?php }
public static function display_backend() { ?> <fieldset> <legend><?php echo ___('Gravatar fix'); ?> </legend> <p class="description"><?php echo ___('This feature can fix the gravatar image to display in China. Just for Chinese users. If using "Custom default gravatar" please DO NOT enable this feature.'); ?> </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> </tbody> </table> </fieldset> <?php }
public static function display_backend() { ?> <fieldset> <legend><i class="fa fa-fw fa-file-zip-o"></i> <?php echo ___('Image compress settings'); ?> </legend> <p class="description"><?php echo ___('Global image settings.'); ?> </p> <table class="form-table"> <tr> <th><label for="<?php echo __CLASS__; ?> -png2jpg"><?php echo ___('PNG to JPG format'); ?> </label></th> <td> <select name="<?php echo __CLASS__; ?> [png2jpg]" id="<?php echo __CLASS__; ?> -png2jpg" class="widefat"> <?php the_option_list(-1, ___('Disable'), self::get_options('png2jpg')); ?> <?php the_option_list(1, ___('Enable'), self::get_options('png2jpg')); ?> </select> <p class="description"><?php echo ___('It will convent png to jpg image format When user upload image file. This feature always disable if is administrator.'); ?> </p> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -jpg-quality"><?php echo ___('JPG image compress quality'); ?> </label></th> <td> <select name="<?php echo __CLASS__; ?> [jpg-quality]" id="<?php echo __CLASS__; ?> -jpg-quality" class="widefat"> <?php for ($i = 100; $i >= 50; $i -= 5) { the_option_list($i, sprintf(___('Level %d'), $i), self::get_jpg_quality()); } ?> </select> <p class="description"><?php echo ___('It will compress image When user upload image file.'); ?> </p> </td> </tr> </table> </fieldset> <?php }
public static function display_backend() { ?> <fieldset id="<?php echo __CLASS__; ?> "> <legend><i class="fa fa-envelope fa-fw"></i> <?php echo ___('SMTP mail settings'); ?> </legend> <p class="description"><?php echo ___('Send mail using smtp server instead of the default mode.'); ?> </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> <?php foreach (self::get_types() as $k => $v) { ?> <tr> <th><label for="<?php echo __CLASS__; ?> -<?php echo $k; ?> "><?php echo $v['title']; ?> </label></th> <td> <input type="<?php echo isset($v['type']) ? $v['type'] : 'text'; ?> " name="<?php echo __CLASS__; ?> [<?php echo $k; ?> ]" id="<?php echo __CLASS__; ?> -<?php echo $k; ?> " value="<?php echo stripslashes(self::get_options($k)); ?> " placeholder="<?php echo $v['placeholder']; ?> " class="<?php echo isset($v['type']) && $v['type'] === 'number' ? 'short-text' : 'widefat'; ?> "> <p class="description"><?php echo $v['des']; ?> </p> </td> </tr> <?php } ?> <tr> <th><label for="<?php echo __CLASS__; ?> -test-mail"><?php echo ___('Test'); ?> </label></th> <td> <div id="<?php echo __CLASS__; ?> -tip" class="page-tip none"></div> <div id="<?php echo __CLASS__; ?> -area-btn"> <input type="email" id="<?php echo __CLASS__; ?> -test-mail" placeholder="<?php echo ___('Type your test mail'); ?> "> <a id="<?php echo __CLASS__; ?> -test-btn" href="javascript:;" class="button button-primary"><i class="fa fa-send"></i> <?php echo ___('Send a test mail'); ?> </a> </div> </td> </tr> </tbody> </table> </fieldset> <?php }
public static function display_backend() { ?> <fieldset> <legend><i class="fa fa-fw fa-truck"></i> <?php echo ___('Post source settings'); ?> </legend> <p class="description"><?php echo ___('The post source will display below the main content. Here are some keywords to use.'); ?> </p> <input type="text" class="small-text text-select" value="%site_name%" title="<?php echo ___('Site name'); ?> " readonly> <input type="text" class="small-text text-select" value="%site_url%" title="<?php echo ___('Site URL'); ?> " readonly> <input type="text" class="small-text text-select" value="%post_author_name%" title="<?php echo ___('Post author name'); ?> " readonly> <input type="text" class="small-text text-select" value="%post_author_url%" title="<?php echo ___('Post author URL'); ?> " readonly> <input type="text" class="small-text text-select" value="%post_url%" title="<?php echo ___('Post URL'); ?> " readonly> <input type="text" class="small-text text-select" value="%source_url%" title="<?php echo ___('Source URL'); ?> " readonly> <input type="text" class="small-text text-select" value="%source_author_name%" title="<?php echo ___('Source author name'); ?> " readonly> <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> <!-- original --> <tr> <th><label for="<?php echo __CLASS__; ?> -text-original"><?php echo ___('HTML: if the post is original'); ?> </label></th> <td> <textarea name="<?php echo __CLASS__; ?> [text-original]" id="<?php echo __CLASS__; ?> -text-original" rows="5" class="widefat"><?php echo self::get_text('text-original'); ?> </textarea> </td> </tr> <!-- reprint author and url --> <tr> <th><label for="<?php echo __CLASS__; ?> -text-reprint-author-url"><?php echo ___('HTML: if the post is reprint and has original author and URL'); ?> </label></th> <td> <textarea name="<?php echo __CLASS__; ?> [text-reprint-author-url]" id="<?php echo __CLASS__; ?> -text-reprint-author-url" rows="5" class="widefat"><?php echo self::get_text('text-reprint-author-url'); ?> </textarea> </td> </tr> <!-- reprint author and url --> <tr> <th><label for="<?php echo __CLASS__; ?> -text-reprint-author"><?php echo ___('HTML: if the post is reprint and has original author but no URL'); ?> </label></th> <td> <textarea name="<?php echo __CLASS__; ?> [text-reprint-author]" id="<?php echo __CLASS__; ?> -text-reprint-author" rows="5" class="widefat"><?php echo self::get_text('text-reprint-author'); ?> </textarea> </td> </tr> <!-- reprint no author and no url --> <tr> <th><label for="<?php echo __CLASS__; ?> -text-reprint"><?php echo ___('HTML: if the post is reprint but no original and no URL'); ?> </label></th> <td> <textarea name="<?php echo __CLASS__; ?> [text-reprint]" id="<?php echo __CLASS__; ?> -text-reprint" rows="5" class="widefat"><?php echo self::get_text('text-reprint'); ?> </textarea> </td> </tr> </tbody> </table> </fieldset> <?php }
function form($instance = []) { $instance = array_merge(['title' => ___('Posts rank'), 'posts_per_page' => 6, 'date' => 'all', 'category__in' => [], 'content_type' => 'img', 'orderby' => 'latest'], $instance); ?> <p> <label for="<?php echo self::get_field_id('title'); ?> "><?php echo ___('Title (optional)'); ?> </label> <input id="<?php echo self::get_field_id('title'); ?> " class="widefat" name="<?php echo self::get_field_name('title'); ?> " type="text" value="<?php echo $instance['title']; ?> " placeholder="<?php echo ___('Title (optional)'); ?> " /> </p> <p> <label for="<?php echo self::get_field_id('posts_per_page'); ?> "><?php echo ___('Post number (required)'); ?> </label> <input id="<?php echo self::get_field_id('posts_per_page'); ?> " class="widefat" name="<?php echo self::get_field_name('posts_per_page'); ?> " type="number" value="<?php echo $instance['posts_per_page']; ?> " placeholder="<?php echo ___('Post number (required)'); ?> " /> </p> <p> <?php echo ___('Categories: '); ?> <?php self::get_cat_checkbox_list(self::get_field_name('category__in'), self::get_field_id('category__in'), $instance['category__in']); ?> </p> <!-- date --> <p> <label for="<?php echo self::get_field_id('date'); ?> "><?php echo ___('Date'); ?> </label> <select name="<?php echo self::get_field_name('date'); ?> " class="widefat" id="<?php echo self::get_field_id('date'); ?> " > <?php foreach (self::get_rank_data() as $k => $v) { the_option_list($k, $v, $instance['date']); } ?> </select> </p> <p> <label for="<?php echo self::get_field_id('content_type'); ?> "><?php echo ___('Content type'); ?> </label> <select name="<?php echo self::get_field_name('content_type'); ?> " class="widefat" id="<?php echo self::get_field_id('content_type'); ?> " > <?php /** * image type */ the_option_list('img', ___('Image type'), $instance['content_type']); /** * text type */ the_option_list('tx', ___('Text type'), $instance['content_type']); ?> </select> </p> <p> <label for="<?php echo self::get_field_id('orderby'); ?> "> <?php echo ___('Order by'); ?> </label> <select name="<?php echo self::get_field_name('orderby'); ?> " class="widefat" id="<?php echo self::get_field_id('orderby'); ?> " > <?php /** * orderby views */ if (class_exists('theme_post_views') && theme_post_views::is_enabled()) { the_option_list('views', ___('Most views'), $instance['orderby']); } /** * orderby thumb-up */ if (class_exists('theme_post_thumb') && theme_post_thumb::is_enabled()) { the_option_list('thumb-up', ___('Thumb up'), $instance['orderby']); } /** * orderby recommended */ if (class_exists('theme_recommended_post')) { the_option_list('recommended', ___('Recommended'), $instance['orderby']); } /** * orderby random */ the_option_list('random', ___('Random'), $instance['orderby']); /** * orderby latest */ the_option_list('latest', ___('Latest'), $instance['orderby']); ?> </select> </p> <?php }
public static function display_backend() { ?> <fieldset> <legend><i class="fa fa-fw fa-comments"></i> <?php echo ___('Comment AJAX settings'); ?> </legend> <p class="description"><?php echo ___('Submitted comment without refreshing page. Recommended enable to improve the user experience.'); ?> </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__; ?> -lang-loading"><?php echo ___('Submitting text'); ?> </label></th> <td> <input type="text" class="widefat" name="<?php echo __CLASS__; ?> [lang-loading]" id="<?php echo __CLASS__; ?> -lang-loading" value="<?php echo self::get_options('lang-loading'); ?> "> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -lang-comment-success"><?php echo ___('Submitted success for visitor'); ?> </label></th> <td> <input type="text" class="widefat" name="<?php echo __CLASS__; ?> [lang-comment-success]" id="<?php echo __CLASS__; ?> -lang-comment-success" value="<?php echo self::get_options('lang-comment-success'); ?> "> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -lang-logged-comment-success"><?php echo ___('Submitted success for logged user'); ?> </label></th> <td> <input type="text" class="widefat" name="<?php echo __CLASS__; ?> [lang-logged-comment-success]" id="<?php echo __CLASS__; ?> lang-logged-comment-success" value="<?php echo self::get_options('lang-logged-comment-success'); ?> "> </td> </tr> </tbody> </table> </fieldset> <?php }
private static function get_home_box_tpl($placeholder = '%placeholder%', array $boxes = []) { $title = isset($boxes[$placeholder]['title']) ? stripcslashes($boxes[$placeholder]['title']) : null; if ($placeholder !== '%placeholder%' && !$title) { return false; } $icon = isset($boxes[$placeholder]['icon']) ? $boxes[$placeholder]['icon'] : null; $link = isset($boxes[$placeholder]['link']) ? $boxes[$placeholder]['link'] : null; $number = isset($boxes[$placeholder]['number']) ? (int) $boxes[$placeholder]['number'] : 7; $display = isset($boxes[$placeholder]['display-type']) ? $boxes[$placeholder]['display-type'] : 'all'; $keywords = isset($boxes[$placeholder]['keywords']) ? $boxes[$placeholder]['keywords'] : null; $ad = isset($boxes[$placeholder]['ad']) ? stripslashes($boxes[$placeholder]['ad']) : null; ob_start(); ?> <table class="form-table <?php echo __CLASS__; ?> -item item tpl-item" id="<?php echo __CLASS__; ?> -item-<?php echo $placeholder; ?> " data-placeholder="<?php echo $placeholder; ?> " > <tbody> <tr> <th><label for="<?php echo __CLASS__; ?> -title-<?php echo $placeholder; ?> "><?php echo ___('Title'); ?> - <?php echo $placeholder; ?> </label></th> <td> <input type="text" name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][title]" id="<?php echo __CLASS__; ?> -title-<?php echo $placeholder; ?> " class="widefat" value="<?php echo esc_attr($title); ?> " placeholder="<?php echo ___('Box title'); ?> " > </td> </tr> <tr> <th> <label for="<?php echo __CLASS__; ?> -icon-<?php echo $placeholder; ?> "><?php echo ___('Icon'); ?> </label> <a href="//fortawesome.github.io/Font-Awesome/icons" target="_blank" title="<?php echo ___('Views all icons'); ?> ">#<?php echo ___('ALL'); ?> </a> </th> <td> <input type="text" value="<?php echo $icon; ?> " list="<?php echo __CLASS__; ?> -icon-<?php echo $placeholder; ?> -datalist" name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][icon]" id="<?php echo __CLASS__; ?> -icon-<?php echo $placeholder; ?> " class="widefat" ><?php icon_option_list(__CLASS__ . '-icon-' . $placeholder . '-datalist'); ?> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -link-<?php echo $placeholder; ?> "><?php echo ___('Link'); ?> </label></th> <td> <input type="url" name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][link]" id="<?php echo __CLASS__; ?> -link-<?php echo $placeholder; ?> " class="widefat" value="<?php echo esc_attr($link); ?> " placeholder="<?php echo ___('Box link (include http://)'); ?> " > </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -number-<?php echo $placeholder; ?> "><?php echo ___('Show posts'); ?> </label></th> <td> <input type="number" name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][number]" id="<?php echo __CLASS__; ?> -number-<?php echo $placeholder; ?> " class="small-text" value="<?php echo $number; ?> " placeholder="<?php echo ___('Posts number.'); ?> " min="3" step="4" > </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -display-type-<?php echo $placeholder; ?> "><?php echo ___('Display type'); ?> </label></th> <td> <select name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][display-type]" id="<?php echo __CLASS__; ?> -display-type-<?php echo $placeholder; ?> " class="widefat" > <?php the_option_list('all', ___('All'), $display); ?> <?php the_option_list('login', ___('Only login'), $display); ?> <?php the_option_list('logout', ___('Only logout'), $display); ?> </select> </td> </tr> <tr> <th><?php echo ___('Categories'); ?> </th> <td> <?php self::cat_checkbox_tpl($placeholder); ?> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -keywords"><?php echo ___('Keywords and links'); ?> </label></th> <td> <textarea name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][keywords]" id="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -keywords" cols="30" rows="5" class="widefat" placeholder="<?php echo ___('Eg. Tag1 = http://inn-studio.com'); ?> "><?php echo esc_textarea($keywords); ?> </textarea> <span class="description"><?php echo ___('Per keyword/line'); ?> </span> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -ad"><?php echo ___('AD code'); ?> </label></th> <td> <textarea name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][ad]" id="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -ad" cols="30" rows="5" class="widefat" placeholder="<?php echo ___('HTML code will display below this box.'); ?> "><?php echo $ad; ?> </textarea> </td> </tr> <tr> <th><?php echo ___('Control'); ?> </th> <td> <a href="javascript:;" class="del" data-target="<?php echo __CLASS__; ?> -item-<?php echo $placeholder; ?> "><i class="fa fa-exclamation-circle"></i> <?php echo ___('Delete this item'); ?> </a> </td> </tr> </tbody> </table> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
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 display_backend() { $opt = (array) self::get_options(); ?> <fieldset> <legend><i class="fa fa-fw fa-paint-brush"></i> <?php echo ___('Contribution settings'); ?> </legend> <p class="description"><?php echo ___('About contribution setting.'); ?> </p> <table class="form-table"> <tbody> <tr> <th><?php echo ___('Shows categories'); ?> </th> <td> <?php theme_features::cat_checkbox_list(__CLASS__, 'cats'); ?> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -tags-number"><?php echo ___('Shows tags number'); ?> </label></th> <td> <input class="short-text" type="number" name="<?php echo __CLASS__; ?> [tags-number]" id="<?php echo __CLASS__; ?> -tags-number" value="<?php echo isset($opt['tags-number']) ? $opt['tags-number'] : 6; ?> "> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -pending-after-edited"><?php echo ___('Pending after edited'); ?> </label></th> <td> <select name="<?php echo __CLASS__; ?> [pending-after-edited]" id="<?php echo __CLASS__; ?> -pending-after-edited" class="widefat"> <?php the_option_list(-1, ___('Disable'), self::get_options('pending-after-edited')); ?> <?php the_option_list(1, ___('Enable'), self::get_options('pending-after-edited')); ?> </select> <p class="description"><?php echo ___('After the post of contributor published, if contributor edit the post which post status will become to pending if enable.'); ?> </p> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -description"><?php echo htmlentities(___('You can write some description for contribution page header. Please use tag <p> to wrap your HTML codes.')); ?> </label></th> <td> <textarea name="<?php echo __CLASS__; ?> [description]" id="<?php echo __CLASS__; ?> -description" class="widefat" rows="5"><?php echo self::get_des(); ?> </textarea> </td> </tr> </tbody> </table> </fieldset> <?php }
public static function display_backend() { $opt = (array) self::get_options(); ?> <fieldset> <legend><i class="fa fa-fw fa-leanpub"></i> <?php echo ___('Collection settings'); ?> </legend> <table class="form-table"> <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><?php echo ___('Which categories will be added after submit?'); ?> </th> <td> <?php theme_features::cat_checkbox_list(__CLASS__, 'cats'); ?> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -tags-number"><?php echo ___('Shows tags number'); ?> </label></th> <td> <input class="short-text" type="number" name="<?php echo __CLASS__; ?> [tags-number]" id="<?php echo __CLASS__; ?> -tags-number" value="<?php echo (int) self::get_options('tags-number'); ?> " min="1"> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -posts-min-number"><?php echo ___('Post boxes min number'); ?> </label></th> <td> <input class="short-text" type="number" name="<?php echo __CLASS__; ?> [posts-min-number]" id="<?php echo __CLASS__; ?> -posts-min-number" value="<?php echo (int) self::get_options('posts-min-number'); ?> " min="1"> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -posts-max-number"><?php echo ___('Post boxes max number'); ?> </label></th> <td> <input class="short-text" type="number" name="<?php echo __CLASS__; ?> [posts-max-number]" id="<?php echo __CLASS__; ?> -posts-max-number" value="<?php echo (int) self::get_options('posts-max-number'); ?> " min="1"> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -description"><?php echo esc_html(___('You can write some description for collection page header. Please use tag <p> to wrap your HTML codes.')); ?> </label></th> <td> <textarea name="<?php echo __CLASS__; ?> [description]" id="<?php echo __CLASS__; ?> -description" class="widefat" rows="5"><?php echo self::get_des(); ?> </textarea> </td> </tr> </table> </fieldset> <?php }
public static function backend_display() { $opt = self::get_options(); ?> <fieldset> <legend><i class="fa fa-fa fa-share-alt"></i> <?php echo ___('Posts share settings'); ?> </legend> <p class="description"> <?php echo ___('Share your post to everywhere. Here are some keywords that can be used:'); ?> </p> <p class="description"> <input type="text" class="small-text text-select" value="%post_title_text%" title="<?php echo ___('Post Title text'); ?> " readonly /> <input type="text" class="small-text text-select" value="%post_url%" title="<?php echo ___('Post URL'); ?> " readonly /> <input type="text" class="small-text text-select" value="%blog_name%" title="<?php echo ___('Blog name'); ?> " readonly /> <input type="text" class="small-text text-select" value="%blog_url%" title="<?php echo ___('Blog URL'); ?> " readonly /> <input type="text" class="small-text text-select" value="%img_url%" title="<?php echo ___('The first picture of the post.'); ?> " readonly /> <input type="text" class="small-text text-select" value="%post_excerpt%" title="<?php echo ___('The excerpt of post.'); ?> " readonly /> <input type="text" class="small-text text-select" value="%post_content%" title="<?php echo ___('The content of post.'); ?> " readonly /> </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 scope="row"><?php echo ___('HTML codes'); ?> </th> <td><textarea id="<?php echo __CLASS__; ?> _code" name="<?php echo __CLASS__; ?> [code]" class="widefat" cols="30" rows="10"><?php echo stripslashes($opt['code']); ?> </textarea> </td> </tr> <tr> <th scope="row"><?php echo esc_html(___('Restore')); ?> </th> <td> <label for="<?php echo __CLASS__; ?> _restore"> <input type="checkbox" id="<?php echo __CLASS__; ?> _restore" name="<?php echo __CLASS__; ?> [restore]" value="1"/> <?php echo ___('Restore the post share settings'); ?> </label> </td> </tr> </tbody> </table> </fieldset> <?php }
public static function display_backend() { ?> <fieldset> <legend><?php echo ___('Post views settings'); ?> </legend> <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> <?php if (wp_using_ext_object_cache()) { ?> <tr> <th><label for="<?php echo __CLASS__; ?> -storage-times"><?php echo ___('Max cache storage times'); ?> </label></th> <td> <input class="short-text" type="number" name="<?php echo __CLASS__; ?> [storage-times]" id="<?php echo __CLASS__; ?> -storage-times" value="<?php echo self::get_storage_times(); ?> " min="1"> <span class="description"><?php echo ___('Using cache to improve performance. When the views more than max storage times, views will be save to database.'); ?> </span> </td> </tr> <?php } ?> </tbody> </table> </fieldset> <?php }
public static function display_backend() { $recomm_posts = self::get_ids(); ?> <fieldset> <legend><i class="fa fa-fw fa-thumbs-o-up"></i> <?php echo ___('Recommended posts'); ?> </legend> <p><?php echo ___('Recommended posts will display on home page if enabled.'); ?> </p> <table class="form-table"> <tbody> <tr> <th><label for="<?php echo __CLASS__; ?> -enabled"></label><?php echo ___('Enable or not?'); ?> </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__; ?> -title"></label><?php echo ___('Box title'); ?> </th> <td> <input type="text" name="<?php echo __CLASS__; ?> [title]" id="<?php echo __CLASS__; ?> -title" value="<?php echo self::get_item('title'); ?> " class="widefat"> </td> </tr> <tr> <th> <label for="<?php echo __CLASS__; ?> -icon"><?php echo ___('Box icon'); ?> </label> <a href="//fortawesome.github.io/Font-Awesome/icons" target="_blank" title="<?php echo ___('Views all icons'); ?> ">#<?php echo ___('ALL'); ?> </a> </th> <td> <input type="text" value="<?php echo self::get_item('icon'); ?> " list="<?php echo __CLASS__; ?> -icon-datalist" name="<?php echo __CLASS__; ?> [icon]" id="<?php echo __CLASS__; ?> -icon" class="widefat" ><?php icon_option_list(__CLASS__ . '-icon-datalist'); ?> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -number"></label><?php echo ___('Show posts number'); ?> </th> <td> <input type="number" name="<?php echo __CLASS__; ?> [number]" id="<?php echo __CLASS__; ?> -number" min="4" step="4" value="<?php echo self::get_item('number'); ?> " class="short-text"> </td> </tr> <tr> <th scope="row"><?php echo ___('Marked posts'); ?> </th> <td> <?php if (!empty($recomm_posts)) { global $post; $query = new WP_Query(['posts_per_page' => -1, 'post__in' => $recomm_posts, 'ignore_sticky_posts' => true]); if ($query->have_posts()) { foreach ($query->posts as $post) { setup_postdata($post); ?> <label for="<?php echo __CLASS__; ?> -<?php echo $post->ID; ?> " class="button"> <input type="checkbox" id="<?php echo __CLASS__; ?> -<?php echo $post->ID; ?> " name="<?php echo __CLASS__; ?> [ids][]" value="<?php echo $post->ID; ?> " checked > #<?php echo $post->ID; ?> <?php echo theme_cache::get_the_title($post->ID); ?> <a href="<?php echo esc_url(get_edit_post_link($post->ID)); ?> " target="_blank" title="<?php echo ___('Open in open window'); ?> "><i class="fa fa-external-link"></i></a> </label> <?php } wp_reset_postdata(); } else { echo status_tip('info', ___('No any post yet')); } } else { echo status_tip('info', ___('No any post yet')); } ?> </td> </tr> </tbody> </table> </fieldset> <?php }
function form($instance = []) { $instance = array_merge(['title' => ___('Advertisement'), 'type' => 'all', 'code' => null], $instance); ?> <p> <label for="<?php echo self::get_field_id('type'); ?> "><?php echo ___('Type'); ?> </label> <select name="<?php echo self::get_field_name('type'); ?> " class="widefat" id="<?php echo self::get_field_id('type'); ?> " > <?php the_option_list('all', ___('All'), $instance['type']); ?> <?php the_option_list('desktop', ___('Desktop'), $instance['type']); ?> <?php the_option_list('mobile', ___('Mobile'), $instance['type']); ?> </select> </p> <p> <label for="<?php echo self::get_field_id('code'); ?> "><?php echo ___('Code'); ?> </label> <textarea name="<?php echo self::get_field_name('code'); ?> " id="<?php echo self::get_field_id('code'); ?> " cols="30" rows="10" class="widefat" ><?php echo stripslashes($instance['code']); ?> </textarea> </p> <?php }
public static function get_tpl_backend($placeholder = '%placeholder%', array $item = []) { $name = isset($item[$placeholder]['name']) ? esc_attr($item[$placeholder]['name']) : null; $type = isset($item[$placeholder]['type']) ? $item[$placeholder]['type'] : 'standard'; $des = isset($item[$placeholder]['des']) ? esc_attr($item[$placeholder]['des']) : null; $question = isset($item[$placeholder]['question']) ? esc_attr($item[$placeholder]['question']) : null; $success = isset($item[$placeholder]['success']) ? esc_attr($item[$placeholder]['success']) : null; $comment = isset($item[$placeholder]['comment']) ? esc_attr($item[$placeholder]['comment']) : null; ob_start(); ?> <table id="<?php echo __CLASS__; ?> -item-<?php echo $placeholder; ?> " class="form-table item tpl-item" data-placeholder="<?php echo $placeholder; ?> "> <tbody> <tr> <th><label for="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -name"><?php echo ___('Name'); ?> - <?php echo $placeholder; ?> </label></th> <td> <input name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][name]" type="text" id="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -name" value="<?php echo $name; ?> " placeholder="<?php echo ___('The item name, short is better'); ?> " class="widefat"> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -type"><?php echo ___('Type'); ?> </label></th> <td> <select name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][type]" id="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -type" class="widefat"> <?php the_option_list('standard', ___('Standard'), $type); ?> <?php the_option_list('custom', ___('Custom'), $type); ?> </select> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -question"><?php echo ___('Question'); ?> </label></th> <td> <input name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][question]" type="text" id="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -question" value="<?php echo $question; ?> " placeholder="<?php echo ___('The item question, only shows in custom type'); ?> " class="widefat"> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -des"><?php echo ___('Description'); ?> </label></th> <td> <input name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][des]" type="text" id="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -des" value="<?php echo $des; ?> " placeholder="<?php echo ___('The item description'); ?> " class="widefat"> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -success"><?php echo ___('After successful reported'); ?> </label></th> <td> <input name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][success]" type="text" id="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -success" value="<?php echo $success; ?> " placeholder="<?php echo ___('The item after successful reported tip'); ?> " class="widefat"> </td> </tr> <tr> <th><label for="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -comment"><?php echo ___('Comment content'); ?> </label></th> <td> <input name="<?php echo __CLASS__; ?> [<?php echo $placeholder; ?> ][comment]" type="text" id="<?php echo __CLASS__; ?> -<?php echo $placeholder; ?> -comment" value="<?php echo $comment; ?> " placeholder="<?php echo ___('The item comment content'); ?> " class="widefat"> </td> </tr> <tr> <th><?php echo ___('Control'); ?> </th> <td> <a href="javascript:;" class="del" data-target="<?php echo __CLASS__; ?> -item-<?php echo $placeholder; ?> "><i class="fa fa-exclamation-circle"></i> <?php echo ___('Delete this item'); ?> </a> </td> </tr> </tbody> </table> <?php $html = html_minify(ob_get_contents()); ob_end_clean(); return $html; }