Import legacy nurinda.co.id website

This commit is contained in:
dirga committed 2026-10-01 14:27:19 +07:00
1 parent 3f59bb9038
commit 6e21646ac4
13389 files changed
+3246690

No files matched your search

@@ -0,0 +1,145 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* UpSolution Widget: Blog
*
* Class US_Widget_Blog
*/
class US_Widget_Blog extends US_Widget {
/**
* Output the widget
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
* @return NULL
*/
function widget( $args, $instance ) {
// If we are running US Grid loop already, return nothing
global $us_grid_loop_running;
if ( isset( $us_grid_loop_running ) AND $us_grid_loop_running ) {
return NULL;
}
$us_grid_loop_running = TRUE;
parent::before_widget( $args, $instance );
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
$output = $args['before_widget'];
if ( $title ) {
$output .= '<h3 class="widgettitle">' . $title . '</h3>';
}
// Preparing query
$query_args = array(
'post_type' => 'post',
);
// Providing proper post statuses
$query_args['post_status'] = array( 'publish' => 'publish' );
$query_args['post_status'] += (array) get_post_stati( array( 'public' => TRUE ) );
$query_args['post_status'] = array_values( $query_args['post_status'] );
if ( ! empty( $instance['ignore_sticky'] ) AND $instance['ignore_sticky'][0] ) {
$query_args['ignore_sticky_posts'] = 1;
}
if ( ! empty( $instance['categories'] ) ) {
$query_args['category_name'] = implode( ', ', $instance['categories'] );
}
// Setting posts order
$orderby_translate = array(
'date' => 'date',
'date_asc' => 'date',
'alpha' => 'title',
'rand' => 'rand',
);
$order_translate = array(
'date' => 'DESC',
'date_asc' => 'ASC',
'alpha' => 'ASC',
'rand' => '',
);
$orderby = ( in_array( $instance['orderby'], array( 'date', 'date_asc', 'alpha', 'rand' ) ) ) ? $instance['orderby'] : 'date';
if ( $orderby == 'rand' ) {
$query_args['orderby'] = 'rand';
} else {
$query_args['orderby'] = array(
$orderby_translate[$orderby] => $order_translate[$orderby],
);
}
// Posts per page
$instance['items'] = max( 0, intval( $instance['items'] ) );
if ( $instance['items'] > 0 ) {
$query_args['posts_per_page'] = $instance['items'];
}
// Exclude current post from grid
if ( is_singular() ) {
$current_ID = get_the_ID();
if ( ! empty( $current_ID ) ) {
$query_args['post__not_in'] = array( $current_ID );
}
}
// Grid indexes, start from 1
global $us_grid_index;
$us_grid_index = isset( $us_grid_index ) ? ( $us_grid_index + 1 ) : 1;
$template_vars = array(
'query_args' => $query_args,
'columns' => 1,
'items_gap' => '1rem', // fixed value for Blog widget
'items_layout' => $instance['layout'],
'pagination' => 'none',
'filter' => FALSE,
'is_widget' => TRUE,
'categories' => ( isset( $instance['categories'] ) AND is_array( $instance['categories'] ) ) ? implode( ', ', $instance['categories'] ) : NULL,
'us_grid_index' => $us_grid_index,
);
ob_start();
global $us_grid_loop_running;
$us_grid_loop_running = TRUE;
us_load_template( 'templates/us_grid/listing', $template_vars );
$us_grid_loop_running = FALSE;
$output .= ob_get_clean();
$output .= $args['after_widget'];
echo $output;
$us_grid_loop_running = FALSE;
}
/**
* Output the settings update form.
*
* @param array $instance Current settings.
*
* @return string Form's output marker that could be used for further hooks
*/
public function form( $instance ) {
$us_post_categories = array();
$us_post_categories_raw = get_categories( "hierarchical=0" );
foreach ( $us_post_categories_raw as $post_category_raw ) {
$us_post_categories[$post_category_raw->name] = $post_category_raw->slug;
}
if ( ! empty( $us_post_categories ) ) {
$this->config['params']['categories'] = array(
'type' => 'checkbox',
'heading' => __( 'Display Items of selected categories', 'us' ),
'value' => $us_post_categories,
);
}
return parent::form( $instance );
}
}
@@ -0,0 +1,47 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* UpSolution Widget: Contacts
*
* Class US_Widget_Contacts
*/
class US_Widget_Contacts extends US_Widget {
/**
* Output the widget
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget( $args, $instance ) {
parent::before_widget( $args, $instance );
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
$output = $args['before_widget'];
if ( $title ) {
$output .= '<h3 class="widgettitle">' . $title . '</h3>';
}
$output .= '<div class="w-contacts"><div class="w-contacts-list">';
foreach ( array( 'address', 'phone', 'fax' ) as $key ) {
if ( empty( $instance[$key] ) ) {
continue;
}
$output .= '<div class="w-contacts-item for_' . $key . '"><span class="w-contacts-item-value">' . $instance[$key] . '</span></div>';
}
if ( ! empty( $instance['email'] ) ) {
$output .= '<div class="w-contacts-item for_email"><span class="w-contacts-item-value"><a href="mailto:' . $instance['email'] . '">' . $instance['email'] . '</a></span></div>';
}
$output .= '</div></div>';
$output .= $args['after_widget'];
echo $output;
}
}
@@ -0,0 +1,69 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* UpSolution Widget: Gallery
*
* Class US_Widget_Media_Gallery
*/
class US_Widget_Media_Gallery extends WP_Widget_Media_Gallery {
public function get_instance_schema() {
$schema = parent::get_instance_schema();
$schema['indents'] = array(
'type' => 'boolean',
'default' => false,
'media_prop' => 'indents',
'should_preview_update' => false,
);
$schema['masonry'] = array(
'type' => 'boolean',
'default' => false,
'media_prop' => 'masonry',
'should_preview_update' => false,
);
$schema['meta'] = array(
'type' => 'boolean',
'default' => false,
'media_prop' => 'meta',
'should_preview_update' => false,
);
$schema['size']['enum'] = array_merge( array( 'full' ), get_intermediate_image_sizes() );
return $schema;
}
public function render_media( $instance ){
$instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance );
$shortcode_atts = $instance;
// @codeCoverageIgnoreStart
if ( $instance['orderby_random'] ) {
$shortcode_atts['orderby'] = 'rand';
}
$shortcode_atts['link'] = isset( $instance['link_type'] ) ? $instance['link_type'] : '';
if ( isset( $shortcode_atts['indents'] ) AND $shortcode_atts['indents'] ) {
$shortcode_atts['indents'] = 'true';
}
if ( isset( $shortcode_atts['masonry'] ) AND $shortcode_atts['masonry'] ) {
$shortcode_atts['masonry'] = 'true';
}
if ( isset( $shortcode_atts['meta'] ) AND $shortcode_atts['meta'] ) {
$shortcode_atts['meta'] = 'true';
}
// @codeCoverageIgnoreEnd
global $us_shortcodes;
echo $us_shortcodes->gallery( $shortcode_atts );
}
}
@@ -0,0 +1,120 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* UpSolution Widget: Login
*
* Class US_Widget_Login
*/
class US_Widget_Login extends US_Widget {
/**
* Output the widget
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget( $args, $instance ) {
parent::before_widget( $args, $instance );
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
echo $args['before_widget'];
// Output title
if ( $title ) {
echo '<h3 class="widgettitle">' . $title . '</h3>';
}
$json_data = array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'logout_redirect' => $instance['logout_redirect'],
'login_redirect' => $instance['login_redirect'],
);
// Output preloader
echo '<div class="g-preloader type_1"></div>';
// Output profile block
$output = '<div class="w-profile-json hidden"' . us_pass_data_to_js( $json_data ) . '></div>';
$output .= '<div class="w-profile hidden">';
$output .= '<a class="w-profile-link for_user" href="' . esc_url( admin_url( 'profile.php' ) ) . '">';
$output .= '<span class="w-profile-avatar"></span>';
$output .= '<span class="w-profile-name"></span>';
$output .= '</a>';
$output .= '<a class="w-profile-link for_logout" href="">' . us_translate( 'Log Out' ) . '</a>';
$output .= '</div>';
echo $output;
$form_template_vars = array(
'type' => 'login hidden',
'action' => site_url( 'wp-login.php' ),
'method' => 'post',
'fields' => array(
'log' => array(
'type' => 'text',
'placeholder' => us_translate( 'Username' ),
'required' => TRUE,
'icon' => 'far|user'
),
'pwd' => array(
'type' => 'password',
'placeholder' => us_translate( 'Password' ),
'required' => TRUE,
'icon' => 'far|lock'
),
'submit' => array(
'type' => 'submit',
'title' => us_translate( 'Log In' ),
'btn_classes' => 'us-btn-style_1',
),
'rememberme' => array(
'type' => 'hidden',
'value' => 'forever',
),
'nonce' => array(
'type' => 'nonce',
'action' => 'us_ajax_login_nonce',
'name' => 'us_login_nonce',
),
),
);
if ( ! empty( $instance['login_redirect'] ) ) {
$form_template_vars['fields']['redirect_to'] = array(
'type' => 'hidden',
'value' => $instance['login_redirect'],
);
}
if ( $instance['register'] != '' OR $instance['lostpass'] != '' ) {
$form_template_vars['end_html'] = '<div class="w-form-row for_links">';
if ( $instance['register'] != '' ) {
$form_template_vars['end_html'] .= '<a class="w-form-row-link for_register" href="' . esc_url( $instance['register'] ) . '">';
$form_template_vars['end_html'] .= us_translate( 'Register' );
$form_template_vars['end_html'] .= '</a>';
}
if ( $instance['lostpass'] != '' ) {
$form_template_vars['end_html'] .= '<a class="w-form-row-link for_lostpass" href="' . esc_url( $instance['lostpass'] ) . '">';
$form_template_vars['end_html'] .= us_translate( 'Lost your password?' );
$form_template_vars['end_html'] .= '</a>';
}
$form_template_vars['end_html'] .= '</div>';
}
// Output form fields
us_load_template( 'templates/form/form', $form_template_vars );
// If we are in front end editor mode, apply JS to the widget
if ( FALSE AND function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
echo '<script>
jQuery(function($){
if (typeof $us !== "undefined" && typeof $us.WLogin === "function") {
$(".widget_us_login").wUsLogin();
}
});
</script>';
}
echo $args['after_widget'];
}
}
@@ -0,0 +1,151 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* UpSolution Widget: Portfolio
*
* Class US_Widget_Portfolio
*/
class US_Widget_Portfolio extends US_Widget {
/**
* Output the widget
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
* @return NULL
*/
function widget( $args, $instance ) {
// If we are running US Grid loop already, return nothing
global $us_grid_loop_running;
if ( isset( $us_grid_loop_running ) AND $us_grid_loop_running ) {
return NULL;
}
$us_grid_loop_running = TRUE;
parent::before_widget( $args, $instance );
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
$output = $args['before_widget'];
if ( $title ) {
$output .= '<h3 class="widgettitle">' . $title . '</h3>';
}
// Preparing query
$query_args = array(
'post_type' => 'us_portfolio',
);
// Providing proper post statuses
$query_args['post_status'] = array( 'publish' => 'publish' );
$query_args['post_status'] += (array) get_post_stati( array( 'public' => TRUE ) );
$query_args['post_status'] = array_values( $query_args['post_status'] );
if ( ! empty( $instance['categories'] ) ) {
$query_args['us_portfolio_category'] = implode( ', ', $instance['categories'] );
}
// Setting posts order
$orderby_translate = array(
'date' => 'date',
'date_asc' => 'date',
'alpha' => 'title',
'rand' => 'rand',
);
$order_translate = array(
'date' => 'DESC',
'date_asc' => 'ASC',
'alpha' => 'ASC',
'rand' => '',
);
$orderby = ( in_array( $instance['orderby'], array( 'date', 'date_asc', 'alpha', 'rand' ) ) ) ? $instance['orderby'] : 'date';
if ( $orderby == 'rand' ) {
$query_args['orderby'] = 'rand';
} else {
$query_args['orderby'] = array(
$orderby_translate[$orderby] => $order_translate[$orderby],
);
}
// Posts per page
$instance['items'] = max( 0, intval( $instance['items'] ) );
if ( $instance['items'] > 0 ) {
$query_args['posts_per_page'] = $instance['items'];
} else {
$query_args['posts_per_page'] = -1;
}
// Exclude current post from grid
if ( is_singular() ) {
$current_ID = get_the_ID();
if ( ! empty( $current_ID ) ) {
$query_args['post__not_in'] = array( $current_ID );
}
}
// Grid indexes, start from 1
global $us_grid_index;
$us_grid_index = isset( $us_grid_index ) ? ( $us_grid_index + 1 ) : 1;
$template_vars = array(
'query_args' => $query_args,
'columns' => $instance['columns'],
'items_gap' => '1px', // fixed value for Portfolio widget
'items_layout' => $instance['layout'],
'pagination' => 'none',
'filter' => FALSE,
'is_widget' => TRUE,
'us_grid_index' => $us_grid_index,
);
ob_start();
global $us_grid_loop_running;
$us_grid_loop_running = TRUE;
us_load_template( 'templates/us_grid/listing', $template_vars );
$us_grid_loop_running = FALSE;
$output .= ob_get_clean();
$output .= $args['after_widget'];
echo $output;
$us_grid_loop_running = FALSE;
}
/**
* Output the settings update form.
*
* @param array $instance Current settings.
*
* @return string Form's output marker that could be used for further hooks
*/
public function form( $instance ) {
$us_portfolio_categories = array();
$us_portfolio_categories_raw = get_categories(
array(
'taxonomy' => 'us_portfolio_category',
'hierarchical' => 0,
)
);
if ( $us_portfolio_categories_raw ) {
foreach ( $us_portfolio_categories_raw as $portfolio_category_raw ) {
if ( is_object( $portfolio_category_raw ) ) {
$us_portfolio_categories[$portfolio_category_raw->name] = $portfolio_category_raw->slug;
}
}
}
if ( ! empty( $us_portfolio_categories ) ) {
$this->config['params']['categories'] = array(
'type' => 'checkbox',
'heading' => __( 'Display Items of selected categories', 'us' ),
'value' => $us_portfolio_categories,
);
}
return parent::form( $instance );
}
}
@@ -0,0 +1,110 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* UpSolution Widget: Socials
*
* Class US_Widget_Socials
*/
class US_Widget_Socials extends US_Widget {
/**
* Output the widget
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*/
function widget( $args, $instance ) {
parent::before_widget( $args, $instance );
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
$output = $args['before_widget'];
if ( $title ) {
$output .= '<h3 class="widgettitle">' . $title . '</h3>';
}
$classes = ' align_left';
$classes .= ' style_' . $instance['style'];
$classes .= ' hover_' . $instance['hover'];
$classes .= ' color_' . $instance['color'];
$classes .= ' shape_' . $instance['shape'];
$output .= '<div class="w-socials' . $classes . '">';
$output .= '<div class="w-socials-list"' . us_prepare_inline_css( array( 'font-size' => $instance['size'] ) ) . '>';
if ( isset( $this->config['params'] ) AND is_array( $this->config['params'] ) ) {
foreach ( $this->config['params'] as $param_name => $param ) {
if ( in_array(
$param_name, array(
'title',
'size',
'style',
'color',
'shape',
'hover',
'custom_link',
'custom_title',
'custom_icon',
'custom_color',
)
) ) {
// Not all the params are social keys
continue;
}
if ( empty( $instance[$param_name] ) ) {
continue;
}
$param['heading'] = isset( $param['heading'] ) ? $param['heading'] : $param_name;
$social_url = $instance[$param_name];
$social_target = '';
// Email type
if ( $param_name == 'email' ) {
if ( filter_var( $social_url, FILTER_VALIDATE_EMAIL ) ) {
$social_url = 'mailto:' . $social_url;
}
// Skype type
} elseif ( $param_name == 'skype' ) {
if ( strpos( $social_url, ':' ) === FALSE ) {
$social_url = 'skype:' . esc_attr( $social_url );
}
// All others types
} else {
$social_url = esc_url( $social_url );
$social_target = ' target="_blank"';
}
$output .= '<div class="w-socials-item ' . $param_name . '">';
$output .= '<a class="w-socials-item-link"' . $social_target . ' href="' . $social_url . '" aria-label="' . $param['heading'] . '">';
$output .= '<span class="w-socials-item-link-hover"></span>';
$output .= '</a>';
$output .= '<div class="w-socials-item-popup"><span>' . $param['heading'] . '</span></div>';
$output .= '</div>';
}
}
// Custom Link
if ( ( ! empty( $instance['custom_link'] ) ) AND ( ! empty( $instance['custom_icon'] ) ) ) {
$link_style = $hover_style = '';
if ( ! empty( $instance['custom_color'] ) ) {
if ( ! empty( $instance['color'] ) AND $instance['color'] == 'brand' ) {
$link_style = ' style="color: ' . $instance['custom_color'] . ';"';
}
$hover_style = ' style="background: ' . $instance['custom_color'] . ';"';
}
$output .= '<div class="w-socials-item custom">';
$output .= '<a class="w-socials-item-link" target="_blank" href="' . esc_attr( $instance['custom_link'] ) . '" aria-label="' . $instance['custom_title'] . '"' . $link_style . '>';
$output .= '<span class="w-socials-item-link-hover"' . $hover_style . '></span>';
$output .= us_prepare_icon_tag( $instance['custom_icon'] );
$output .= '</a>';
if ( ! empty( $instance['custom_title'] ) ) {
$output .= '<div class="w-socials-item-popup"><span>' . $instance['custom_title'] . '</span></div>';
}
$output .= '</div>';
}
$output .= '</div></div>';
$output .= $args['after_widget'];
echo $output;
}
}