init
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* SMOF Admin
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage SMOF
|
||||
* @since 1.4.0
|
||||
* @author Syamil MJ
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Head Hook
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_head() { do_action( 'of_head' ); }
|
||||
|
||||
/**
|
||||
* Add default options upon activation else DB does not exist
|
||||
*
|
||||
* DEPRECATED, Class_options_machine now does this on load to ensure all values are set
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_option_setup()
|
||||
{
|
||||
global $of_options, $options_machine;
|
||||
$options_machine = new Options_Machine($of_options);
|
||||
|
||||
if (!of_get_options())
|
||||
{
|
||||
of_save_options($options_machine->Defaults);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get header classes
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_get_header_classes_array()
|
||||
{
|
||||
global $of_options;
|
||||
|
||||
foreach ($of_options as $value)
|
||||
{
|
||||
if ($value['type'] == 'heading')
|
||||
$hooks[] = str_replace(' ','',strtolower($value['name']));
|
||||
}
|
||||
|
||||
return $hooks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get options from the database and process them with the load filter hook.
|
||||
*
|
||||
* @author Jonah Dahlquist
|
||||
* @since 1.4.0
|
||||
* @return array
|
||||
*/
|
||||
function of_get_options($key = null, $data = null) {
|
||||
global $smof_data;
|
||||
|
||||
do_action('of_get_options_before', array(
|
||||
'key'=>$key, 'data'=>$data
|
||||
));
|
||||
if ($key != null) { // Get one specific value
|
||||
$data = get_theme_mod($key, $data);
|
||||
} else { // Get all values
|
||||
$data = get_theme_mods();
|
||||
}
|
||||
$data = apply_filters('of_options_after_load', $data);
|
||||
if ($key == null) {
|
||||
$smof_data = $data;
|
||||
} else {
|
||||
$smof_data[$key] = $data;
|
||||
}
|
||||
do_action('of_option_setup_before', array(
|
||||
'key'=>$key, 'data'=>$data
|
||||
));
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Save options to the database after processing them
|
||||
*
|
||||
* @param $data Options array to save
|
||||
* @author Jonah Dahlquist
|
||||
* @since 1.4.0
|
||||
* @uses update_option()
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function of_save_options($data, $key = null) {
|
||||
global $smof_data;
|
||||
if (empty($data))
|
||||
return;
|
||||
do_action('of_save_options_before', array(
|
||||
'key'=>$key, 'data'=>$data
|
||||
));
|
||||
$data = apply_filters('of_options_before_save', $data);
|
||||
if ($key != null) { // Update one specific value
|
||||
if ($key == BACKUPS) {
|
||||
unset($data['smof_init']); // Don't want to change this.
|
||||
}
|
||||
set_theme_mod($key, $data);
|
||||
} else { // Update all values in $data
|
||||
foreach ( $data as $k=>$v ) {
|
||||
if (!isset($smof_data[$k]) || $smof_data[$k] != $v) { // Only write to the DB when we need to
|
||||
set_theme_mod($k, $v);
|
||||
} else if (is_array($v)) {
|
||||
foreach ($v as $key=>$val) {
|
||||
if ($key != $k && $v[$key] == $val) {
|
||||
set_theme_mod($k, $v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
do_action('of_save_options_after', array(
|
||||
'key'=>$key, 'data'=>$data
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For use in themes
|
||||
*
|
||||
* @since forever
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$data = of_get_options();
|
||||
if (!isset($smof_details))
|
||||
$smof_details = array();
|
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
|
||||
function flatsome_facebook_oauth_url() {
|
||||
$api_version = flatsome_facebook_api_version();
|
||||
$uri = get_template_directory_uri();
|
||||
$theme = wp_get_theme( get_template() );
|
||||
$version = $theme->get( 'Version' );
|
||||
$client_id = '380204239234502';
|
||||
$base_url = "https://www.facebook.com/$api_version/dialog/oauth";
|
||||
$redirect_uri = flatsome_api_url() . '/facebook/authorize/';
|
||||
$scope = 'pages_read_engagement,instagram_basic,public_profile';
|
||||
$state = urlencode( admin_url( "admin.php?page=optionsframework&tab=of-option-instagram&ver=$version" ) );
|
||||
$response_type = 'code';
|
||||
|
||||
return "$base_url?client_id=$client_id&response_type=$response_type&scope=$scope&redirect_uri=$redirect_uri&state=$state";
|
||||
}
|
||||
|
||||
function flatsome_facebook_login_button_html() {
|
||||
$url = flatsome_facebook_oauth_url();
|
||||
ob_start(); ?>
|
||||
|
||||
<hr />
|
||||
<p><?php _e('Login with Facebook to connect an Instagram Business account:') ?></p>
|
||||
<a class="button" style="padding: 5px 15px; height: auto; background-color: #4267b2; border-color: #4267b2; color: #ffffff;" href="<?php echo $url ?>">
|
||||
<span class="dashicons dashicons-facebook-alt" style="vertical-align: middle; margin-top: -2px;"></span>
|
||||
<?php _e( 'Login with Facebook', 'flatsome-admin' ) ?>
|
||||
</a>
|
||||
<p>
|
||||
<button class="button" name="flatsome_instagram_clear_cache">
|
||||
<?php _e( 'Clear Instagram cache', 'flatsome-admin' ) ?>
|
||||
</button>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://docs.uxthemes.com/article/379-how-to-connect-to-instagram-api" target="_blank" rel="noopener noreferrer">
|
||||
<?php _e( 'How to setup an Instagram Business account', 'flatsome-admin' ) ?>
|
||||
</a>
|
||||
</p>
|
||||
<?php return ob_get_clean();
|
||||
}
|
||||
|
||||
function flatsome_facebook_accounts_html() {
|
||||
$accounts = flatsome_facebook_accounts();
|
||||
|
||||
ob_start(); ?>
|
||||
|
||||
<input type="hidden" value="0" name="facebook_accounts[]">
|
||||
|
||||
<div class="flatsome-instagram-accounts theme-browser">
|
||||
<div class="themes wp-clearfix">
|
||||
<?php if ( empty( $accounts ) ) : ?>
|
||||
<div class="notice notice-info inline">
|
||||
<p><?php _e('No accounts connected yet...') ?></p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ( $accounts as $username => $account ) : ?>
|
||||
<div class="theme instagram-account instagram-account--<?php echo esc_attr( $username ) ?>" style="width: 46%">
|
||||
<input type="hidden" value="<?php echo esc_attr( $account['id'] ) ?>" name="facebook_accounts[<?php echo esc_attr( $username ) ?>]">
|
||||
<div class="theme-screenshot">
|
||||
<?php if ( ! empty( $account['profile_picture'] ) ) : ?>
|
||||
<img src="<?php echo esc_attr( $account['profile_picture'] ) ?>" alt="<?php echo esc_attr( $username ) ?>">
|
||||
<?php else : ?>
|
||||
<img src="<?php echo get_template_directory_uri() ?>/inc/admin/advanced/assets/images/instagram-profile.png" alt="<?php echo esc_attr( $username ) ?>">
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<!-- <div class="notice inline notice-alt"><p></p></div> -->
|
||||
<div class="theme-id-container">
|
||||
<h2 class="theme-name">
|
||||
<a target="_blank" href="https://www.instagram.com/<?php echo esc_attr( $username ) ?>/">
|
||||
<?php echo esc_html( $username ) ?>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="theme-actions">
|
||||
<button type="button" class="button button-small" onclick="jQuery(this).closest('.instagram-account').remove()">
|
||||
Disconnect
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accounts that is associated with an access token.
|
||||
*
|
||||
* @param string $access_token An access token for a Facebook user.
|
||||
*
|
||||
* @return WP_Error|array
|
||||
*/
|
||||
function flatsome_facebook_get_accounts( $access_token ) {
|
||||
$api_version = flatsome_facebook_api_version();
|
||||
$fields = 'name,access_token,instagram_business_account{id,name,username,profile_picture_url}';
|
||||
$url = "https://graph.facebook.com/$api_version/me/accounts?limit=100&fields=$fields&access_token=$access_token";
|
||||
$response = wp_remote_get( $url );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
return new WP_Error( 'site_down', __( 'Unable to communicate with Instagram.', 'flatsome-admin' ) );
|
||||
} else {
|
||||
$body = json_decode( $response['body'], true );
|
||||
|
||||
if ( array_key_exists( 'error', $body ) ) {
|
||||
return new WP_Error( 'site_down', $body['error']['message'] );
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the popup that shows the accounts that can be connected.
|
||||
*/
|
||||
function flatsome_facebook_connect_admin_footer() {
|
||||
if ( ! is_array( $_GET ) || ! isset( $_GET['flatsome_facebook_access_token'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$access_token = sanitize_text_field( $_GET['flatsome_facebook_access_token'] );
|
||||
$all_accounts = flatsome_facebook_get_accounts( $access_token );
|
||||
$current_accounts = flatsome_facebook_accounts();
|
||||
$accounts = array();
|
||||
|
||||
if ( ! is_wp_error( $all_accounts ) ) {
|
||||
$accounts = array_filter( $all_accounts['data'], function( $account ) {
|
||||
return ! empty( $account['instagram_business_account'] );
|
||||
} );
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
|
||||
<div class="flatsome-instagram-connect">
|
||||
<div class="flatsome-instagram-connect-body">
|
||||
<h2 class=""><?php _e( 'Connect Instagram Business accounts', 'flatsome' ); ?></h2>
|
||||
<?php if ( is_wp_error( $accounts ) ) : ?>
|
||||
<div class="notice notice-error inline" style="margin: 0;">
|
||||
<p><?php echo $accounts->get_error_message() ?></p>
|
||||
</div>
|
||||
<div class="tablenav bottom textright">
|
||||
<button type="button" class="button" onclick="jQuery(this).closest('.flatsome-instagram-connect').hide()">
|
||||
<?php esc_html_e( 'Okay', 'flatsome' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php elseif ( empty( $accounts ) ) : ?>
|
||||
<div class="notice notice-info inline" style="margin: 0;">
|
||||
<p><?php esc_html_e( 'No associated Instagram Business account was found for your Facebook user.', 'flatsome' ) ?></p>
|
||||
</div>
|
||||
<div class="tablenav bottom textright">
|
||||
<button type="button" class="button" onclick="jQuery(this).closest('.flatsome-instagram-connect').hide()">
|
||||
<?php esc_html_e( 'Okay', 'flatsome' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="POST">
|
||||
<input type="hidden" name="action" value="flatsome_instagram_connect" />
|
||||
<?php wp_nonce_field( 'flatsome_instagram_connect', 'flatsome_instagram_connect_nonce' ); ?>
|
||||
<table class="widefat striped">
|
||||
<tbody>
|
||||
<?php foreach ( $accounts as $account ) : ?>
|
||||
<tr>
|
||||
<th class="check-column">
|
||||
<?php if ( ! array_key_exists( $account['instagram_business_account']['username'], $current_accounts ) ) : ?>
|
||||
<input type="checkbox" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][id]" value="<?php echo esc_attr( $account['instagram_business_account']['id'] ) ?>">
|
||||
<?php else : ?>
|
||||
<input type="checkbox" disabled checked>
|
||||
<?php endif ?>
|
||||
<?php if ( ! empty( $account['instagram_business_account']['profile_picture_url'] ) ) : ?>
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][profile_picture]" value="<?php echo esc_attr( $account['instagram_business_account']['profile_picture_url']) ?>">
|
||||
<?php endif ?>
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][username]" value="<?php echo esc_attr( $account['instagram_business_account']['username'] ) ?>">
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][account_id]" value="<?php echo esc_attr( $account['id'] ) ?>">
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][account_access_token]" value="<?php echo esc_attr( $account['access_token'] ) ?>">
|
||||
<input type="hidden" name="instagram_accounts[<?php echo esc_attr( $account['id'] ) ?>][access_token]" value="<?php echo esc_attr( $access_token ) ?>">
|
||||
</th>
|
||||
<td width="38">
|
||||
<?php if ( ! empty( $account['instagram_business_account']['profile_picture_url'] ) ) : ?>
|
||||
<img src="<?php echo esc_attr( $account['instagram_business_account']['profile_picture_url'] ) ?>" width="38" style="border-radius: 100%" alt="<?php echo esc_attr( $account['instagram_business_account']['username'] ) ?>">
|
||||
<?php else : ?>
|
||||
<img src="<?php echo get_template_directory_uri() ?>/inc/admin/advanced/assets/images/instagram-profile.png" width="38" alt="<?php echo esc_attr( $account['instagram_business_account']['username'] ) ?>">
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td class="title">
|
||||
<strong class="row-title">
|
||||
<?php if ( ! empty( $account['instagram_business_account']['name'] ) ) : ?>
|
||||
<?php echo esc_html( $account['instagram_business_account']['name'] ) ?>
|
||||
<?php elseif ( ! empty( $account['name'] ) ) : ?>
|
||||
<?php echo esc_html( $account['name'] ) ?>
|
||||
<?php endif ?>
|
||||
</strong>
|
||||
<br>
|
||||
<a target="_blank" href="https://www.instagram.com/<?php echo esc_attr( $account['instagram_business_account']['username'] ) ?>/">
|
||||
<?php echo '@' . esc_html( $account['instagram_business_account']['username'] ) ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="tablenav bottom textright">
|
||||
<button type="button" class="button" onclick="jQuery(this).closest('.flatsome-instagram-connect').hide()">
|
||||
<?php esc_html_e( 'Cancel', 'flatsome' ); ?>
|
||||
</button>
|
||||
<button name="flatsome_instagram_connect" class="button button-primary">
|
||||
<?php esc_html_e( 'Connect', 'flatsome' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
add_action( 'admin_footer-flatsome_page_optionsframework', 'flatsome_facebook_connect_admin_footer' );
|
||||
|
||||
/**
|
||||
* Saves the connected accounts data.
|
||||
*/
|
||||
function flatsome_facebook_connect_accounts() {
|
||||
check_admin_referer( 'flatsome_instagram_connect', 'flatsome_instagram_connect_nonce' );
|
||||
|
||||
if ( ! empty( $_POST['instagram_accounts'] ) ) {
|
||||
$accounts = flatsome_facebook_accounts();
|
||||
|
||||
foreach ( $_POST['instagram_accounts'] as $values ) {
|
||||
$account = array_map( 'sanitize_text_field', $values );
|
||||
if ( isset( $account['id'] ) ) {
|
||||
$accounts[ $account['username'] ] = $account;
|
||||
}
|
||||
}
|
||||
|
||||
set_theme_mod( 'facebook_accounts', $accounts );
|
||||
}
|
||||
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=optionsframework&tab=of-option-instagram' ) );
|
||||
}
|
||||
add_action( 'admin_post_flatsome_instagram_connect', 'flatsome_facebook_connect_accounts' );
|
||||
|
||||
function flatsome_facebook_set_theme_mod( $values, $old_values ) {
|
||||
$result = array();
|
||||
|
||||
foreach ( $values as $username => $id ) {
|
||||
if ( is_array( $old_values ) && array_key_exists( $username, $old_values ) ) {
|
||||
$result[ $username ] = $old_values[ $username ];
|
||||
} else {
|
||||
$result[ $username ] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
add_filter( 'pre_set_theme_mod_facebook_accounts', 'flatsome_facebook_set_theme_mod', 10, 2 );
|
||||
|
||||
/**
|
||||
* Deletes the Instagram oEmbed cache and transients.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function flatsome_facebook_clear_cache() {
|
||||
global $wpdb;
|
||||
|
||||
if ( isset( $_POST['flatsome_instagram_clear_cache'] ) ) {
|
||||
delete_option( 'flatsome_instagram_oembed_cache' );
|
||||
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE ('%\_transient\_flatsome\_instagram%');" );
|
||||
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE ('%\_transient\_timeout\_flatsome\_instagram%');" );
|
||||
}
|
||||
}
|
||||
add_action( 'of_save_options_before', 'flatsome_facebook_clear_cache' );
|
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
/**
|
||||
* SMOF Interface
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage SMOF
|
||||
* @since 1.4.0
|
||||
* @author Syamil MJ
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Admin Init
|
||||
*
|
||||
* @uses wp_verify_nonce()
|
||||
* @uses header()
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function optionsframework_admin_init()
|
||||
{
|
||||
// Rev up the Options Machine
|
||||
global $of_options, $options_machine, $smof_data, $smof_details;
|
||||
if (!isset($options_machine))
|
||||
$options_machine = new Options_Machine($of_options);
|
||||
|
||||
do_action('optionsframework_admin_init_before', array(
|
||||
'of_options' => $of_options,
|
||||
'options_machine' => $options_machine,
|
||||
'smof_data' => $smof_data
|
||||
));
|
||||
|
||||
if (empty($smof_data['smof_init'])) { // Let's set the values if the theme's already been active
|
||||
of_save_options($options_machine->Defaults);
|
||||
of_save_options(date('r'), 'smof_init');
|
||||
$smof_data = of_get_options();
|
||||
$options_machine = new Options_Machine($of_options);
|
||||
}
|
||||
|
||||
do_action('optionsframework_admin_init_after', array(
|
||||
'of_options' => $of_options,
|
||||
'options_machine' => $options_machine,
|
||||
'smof_data' => $smof_data
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Options page
|
||||
*
|
||||
* @uses add_theme_page()
|
||||
* @uses add_action()
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function optionsframework_add_admin() {
|
||||
|
||||
$of_page = add_submenu_page('flatsome-panel', '', 'Advanced', 'edit_theme_options', 'optionsframework', 'optionsframework_options_page');
|
||||
|
||||
// Add framework functionaily to the head individually
|
||||
add_action("admin_print_scripts-$of_page", 'of_load_only');
|
||||
add_action("admin_print_styles-$of_page",'of_style_only');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build Options page
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function optionsframework_options_page(){
|
||||
|
||||
global $options_machine;
|
||||
|
||||
/*
|
||||
//for debugging
|
||||
|
||||
$smof_data = of_get_options();
|
||||
print_r($smof_data);
|
||||
|
||||
*/
|
||||
|
||||
include_once( ADMIN_PATH . 'front-end/options.php' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Options page
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_style_only() {
|
||||
$theme = wp_get_theme( get_template() );
|
||||
$version = $theme->get( 'Version' );
|
||||
|
||||
wp_enqueue_style( 'admin-style', ADMIN_DIR . 'assets/css/admin-style.css', array(), $version );
|
||||
wp_enqueue_style( 'jquery-ui-custom-admin', ADMIN_DIR . 'assets/css/jquery-ui-custom.css', array(), $version );
|
||||
|
||||
if ( ! wp_style_is( 'wp-color-picker', 'registered' ) ) {
|
||||
wp_register_style( 'wp-color-picker', ADMIN_DIR . 'assets/css/color-picker.min.css', array(), $version );
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
do_action( 'of_style_only_after' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Options page
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_load_only() {
|
||||
$theme = wp_get_theme( get_template() );
|
||||
$version = $theme->get( 'Version' );
|
||||
|
||||
wp_enqueue_script( 'jquery-ui-core' );
|
||||
wp_enqueue_script( 'jquery-ui-sortable' );
|
||||
wp_enqueue_script( 'jquery-ui-slider' );
|
||||
wp_enqueue_script( 'jquery-input-mask', ADMIN_DIR . 'assets/js/jquery.maskedinput-1.4.1.js', array( 'jquery' ), $version, true );
|
||||
wp_enqueue_script( 'tipsy', ADMIN_DIR . 'assets/js/jquery.tipsy.js', array( 'jquery' ), $version, true );
|
||||
wp_enqueue_script( 'cookie', ADMIN_DIR . 'assets/js/cookie.js', 'jquery', $version, true );
|
||||
wp_enqueue_script( 'smof', ADMIN_DIR . 'assets/js/smof.js', array( 'jquery' ), $version, true );
|
||||
|
||||
// Enqueue colorpicker scripts for versions below 3.5 for compatibility.
|
||||
if ( ! wp_script_is( 'wp-color-picker', 'registered' ) ) {
|
||||
wp_register_script( 'iris', ADMIN_DIR . 'assets/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), $version, true );
|
||||
wp_register_script( 'wp-color-picker', ADMIN_DIR . 'assets/js/color-picker.min.js', array( 'jquery', 'iris' ), $version, true );
|
||||
}
|
||||
|
||||
wp_enqueue_script( 'wp-color-picker' );
|
||||
|
||||
/**
|
||||
* Enqueue scripts for file uploader
|
||||
*/
|
||||
if ( function_exists( 'wp_enqueue_media' ) ) {
|
||||
wp_enqueue_media();
|
||||
}
|
||||
|
||||
do_action( 'of_load_only_after' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajax Save Options
|
||||
*
|
||||
* @uses get_option()
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function of_ajax_callback()
|
||||
{
|
||||
global $options_machine, $of_options;
|
||||
|
||||
$nonce=$_POST['security'];
|
||||
|
||||
|
||||
if (! wp_verify_nonce($nonce, 'of_ajax_nonce') ) die('-1');
|
||||
|
||||
//get options array from db
|
||||
$all = of_get_options();
|
||||
|
||||
$save_type = $_POST['type'];
|
||||
|
||||
|
||||
//Uploads
|
||||
if($save_type == 'upload')
|
||||
{
|
||||
|
||||
$clickedID = $_POST['data']; // Acts as the name
|
||||
$filename = $_FILES[$clickedID];
|
||||
$filename['name'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', $filename['name']);
|
||||
|
||||
$override['test_form'] = false;
|
||||
$override['action'] = 'wp_handle_upload';
|
||||
$uploaded_file = wp_handle_upload($filename,$override);
|
||||
|
||||
$upload_tracking[] = $clickedID;
|
||||
|
||||
//update $options array w/ image URL
|
||||
$upload_image = $all; //preserve current data
|
||||
|
||||
$upload_image[$clickedID] = $uploaded_file['url'];
|
||||
|
||||
of_save_options($upload_image);
|
||||
|
||||
|
||||
if(!empty($uploaded_file['error'])) {echo 'Upload Error: ' . $uploaded_file['error']; }
|
||||
else { echo $uploaded_file['url']; } // Is the Response
|
||||
|
||||
}
|
||||
elseif($save_type == 'image_reset')
|
||||
{
|
||||
|
||||
$id = $_POST['data']; // Acts as the name
|
||||
|
||||
$delete_image = $all; //preserve rest of data
|
||||
$delete_image[$id] = ''; //update array key with empty value
|
||||
of_save_options($delete_image ) ;
|
||||
|
||||
}
|
||||
elseif($save_type == 'backup_options')
|
||||
{
|
||||
|
||||
$backup = $all;
|
||||
$backup['backup_log'] = date('r');
|
||||
|
||||
of_save_options($backup, BACKUPS) ;
|
||||
|
||||
die('1');
|
||||
}
|
||||
elseif($save_type == 'restore_options')
|
||||
{
|
||||
|
||||
$smof_data = of_get_options(BACKUPS);
|
||||
|
||||
of_save_options($smof_data);
|
||||
|
||||
die('1');
|
||||
}
|
||||
elseif($save_type == 'import_options'){
|
||||
|
||||
|
||||
$smof_data = unserialize(base64_decode($_POST['data'])); //100% safe - ignore theme check nag
|
||||
of_save_options($smof_data);
|
||||
|
||||
|
||||
die('1');
|
||||
}
|
||||
elseif ($save_type == 'save')
|
||||
{
|
||||
wp_parse_str(stripslashes($_POST['data']), $smof_data);
|
||||
unset($smof_data['security']);
|
||||
unset($smof_data['of_save']);
|
||||
of_save_options($smof_data);
|
||||
flush_rewrite_rules();
|
||||
|
||||
die('1');
|
||||
}
|
||||
elseif ($save_type == 'reset')
|
||||
{
|
||||
of_save_options($options_machine->Defaults);
|
||||
|
||||
die('1'); //options reset
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Functions Load
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage SMOF
|
||||
* @since 1.4.0
|
||||
* @author Syamil MJ
|
||||
*/
|
||||
require_once( ADMIN_PATH . 'functions/functions.php' );
|
||||
require_once( ADMIN_PATH . 'functions/functions.facebook.php' );
|
||||
require_once( ADMIN_PATH . 'functions/functions.interface.php' );
|
||||
require_once( ADMIN_PATH . 'functions/functions.options.php' );
|
||||
require_once( ADMIN_PATH . 'functions/functions.admin.php' );
|
@@ -0,0 +1,692 @@
|
||||
<?php
|
||||
/**
|
||||
* Advanced Theme Options
|
||||
*
|
||||
* @package Flatsome/Admin/Options/Advanced
|
||||
*/
|
||||
|
||||
add_action( 'init', 'of_options' );
|
||||
|
||||
if ( ! function_exists( 'of_options' ) ) {
|
||||
/**
|
||||
* Advance Theme Options.
|
||||
*
|
||||
* @global array $of_options Description.
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
function of_options() {
|
||||
// Access the WordPress Categories via an Array.
|
||||
$of_categories = array();
|
||||
$of_categories_obj = get_categories( 'hide_empty=0' );
|
||||
foreach ( $of_categories_obj as $of_cat ) {
|
||||
$of_categories[ $of_cat->cat_ID ] = $of_cat->cat_name;
|
||||
}
|
||||
|
||||
// Access the WordPress Pages via an Array.
|
||||
$of_pages = array();
|
||||
$of_pages_obj = get_pages( 'sort_column=post_parent,menu_order' );
|
||||
$of_pages['0'] = 'Select a page:';
|
||||
foreach ( $of_pages_obj as $of_page ) {
|
||||
$of_pages[ $of_page->ID ] = $of_page->post_title;
|
||||
}
|
||||
|
||||
// Set the Options Array.
|
||||
global $of_options;
|
||||
$of_options = array();
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Global Settings',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Header Scripts',
|
||||
'desc' => 'Add custom scripts inside HEAD tag. You need to have a SCRIPT tag around scripts.',
|
||||
'id' => 'html_scripts_header',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Footer Scripts',
|
||||
'desc' => 'Add custom scripts you might want to be loaded in the footer of your website. You need to have a SCRIPT tag around scripts.',
|
||||
'id' => 'html_scripts_footer',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Body Scripts - Top',
|
||||
'desc' => 'Add custom scripts just after the BODY tag opened. You need to have a SCRIPT tag around scripts.',
|
||||
'id' => 'html_scripts_after_body',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Body Scripts - Bottom',
|
||||
'desc' => 'Add custom scripts just before the BODY tag closed. You need to have a SCRIPT tag around scripts.',
|
||||
'id' => 'html_scripts_before_body',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Flatsome 2.0 Content Support',
|
||||
'id' => 'flatsome_fallback',
|
||||
'desc' => 'Support content made in Flatsome 2.0. Disable to speed up site.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Custom CSS',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'All screens',
|
||||
'desc' => 'Add custom CSS here',
|
||||
'id' => 'html_custom_css',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Tablets and down',
|
||||
'desc' => 'Add custom CSS here for tablets and mobile',
|
||||
'id' => 'html_custom_css_tablet',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Mobile only',
|
||||
'desc' => 'Add custom CSS here for mobile view',
|
||||
'id' => 'html_custom_css_mobile',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
// Performance.
|
||||
$of_options[] = array(
|
||||
'name' => 'Performance',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'type' => 'info',
|
||||
'desc' => '<p style="font-size:14px">Use with caution! Disable if you have plugin compatibility problems.</p>',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Preload pages',
|
||||
'id' => 'perf_instant_page',
|
||||
'desc' => 'Preload pages right before a user clicks on it for blazing fast browsing between pages.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Lazy Load Banner and Section backgrounds',
|
||||
'id' => 'lazy_load_backgrounds',
|
||||
'desc' => 'Enable lazy loading of banner and section backgrounds.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Lazy Load Images',
|
||||
'id' => 'lazy_load_images',
|
||||
'desc' => 'Enable lazy loading for images. It will generate an inline blank Base64 image with the same aspect ratio as the original image.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable theme style.css',
|
||||
'type' => 'checkbox',
|
||||
'id' => 'flatsome_disable_style_css',
|
||||
'std' => 0,
|
||||
'desc' => 'Disable loading of theme style.css. This file is only needed if you have added custom CSS to that file.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable Emoji script',
|
||||
'type' => 'checkbox',
|
||||
'id' => 'disable_emoji',
|
||||
'std' => 0,
|
||||
'desc' => 'Remove WP emoji scripts from front-end.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable Block library css',
|
||||
'type' => 'checkbox',
|
||||
'id' => 'disable_blockcss',
|
||||
'std' => 0,
|
||||
'desc' => 'Remove default block library css coming from WordPress',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable jQuery Migrate',
|
||||
'type' => 'checkbox',
|
||||
'id' => 'jquery_migrate',
|
||||
'std' => 0,
|
||||
'desc' => 'Remove jQuery Migrate. Most up-to-date front-end code and plugins don’t require jquery-migrate.min.js. More often than not, keeping this - simply adds unnecessary load to your site.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Site Loader',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Site Loader',
|
||||
'id' => 'site_loader',
|
||||
'desc' => 'Enable Site Loader overlay when loading the site.',
|
||||
'type' => 'select',
|
||||
'std' => '',
|
||||
'options' => array(
|
||||
'' => 'Disabled',
|
||||
'home' => 'Enable on homepage',
|
||||
'all' => 'Enable on all pages',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Color',
|
||||
'id' => 'site_loader_color',
|
||||
'type' => 'select',
|
||||
'std' => 'light',
|
||||
'options' => array(
|
||||
'light' => 'Light',
|
||||
'dark' => 'Dark',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Background Color',
|
||||
'id' => 'site_loader_bg',
|
||||
'std' => '',
|
||||
'type' => 'color',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Site Search',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Live Search',
|
||||
'id' => 'live_search',
|
||||
'desc' => 'Enable live search for products, pages and posts.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search placeholder',
|
||||
'desc' => 'Change the search field placeholder.',
|
||||
'id' => 'search_placeholder',
|
||||
'type' => 'text',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search results latency',
|
||||
'desc' => 'Set the delay for live search results.',
|
||||
'id' => 'search_result_latency',
|
||||
'std' => '0',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'0' => 'Instant',
|
||||
'500' => '500 ms',
|
||||
'1000' => '1000 ms',
|
||||
'1500' => '1500 ms',
|
||||
'2000' => '2000 ms',
|
||||
),
|
||||
);
|
||||
|
||||
if ( is_woocommerce_activated() ) {
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Show Blog and pages in search results',
|
||||
'id' => 'search_result',
|
||||
'desc' => 'Enable blog and pages in search results.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Posts and pages list style',
|
||||
'id' => 'search_result_style',
|
||||
'desc' => 'Display results as row, masonry or slider style.',
|
||||
'type' => 'select',
|
||||
'std' => 'slider',
|
||||
'options' => array(
|
||||
'row' => 'Row',
|
||||
'masonry' => 'Masonry',
|
||||
'slider' => 'Slider',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search Products Order By',
|
||||
'id' => 'search_products_order_by',
|
||||
'type' => 'select',
|
||||
'std' => 'relevance',
|
||||
'options' => array(
|
||||
'relevance' => 'Relevance',
|
||||
'title' => 'Title',
|
||||
'price' => 'Price',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search Product SKU',
|
||||
'desc' => 'Allow searching by SKU in live search.',
|
||||
'id' => 'search_by_sku',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Search Product Tag',
|
||||
'desc' => 'Allow searching by product tags in live search.',
|
||||
'id' => 'search_by_product_tag',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
}
|
||||
|
||||
$of_options[] = array(
|
||||
"name" => "Instagram",
|
||||
"type" => "heading",
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
"name" => "Accounts",
|
||||
"std" => flatsome_facebook_accounts_html(),
|
||||
"desc" => flatsome_facebook_login_button_html(),
|
||||
"type" => "info"
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Google APIs',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Google Maps API',
|
||||
'desc' => "Enter Google Maps API key here to enable Maps. You can generate one here: <a target='_blank' href='https://developers.google.com/maps/documentation/javascript/get-api-key'>Google Maps API</a>",
|
||||
'id' => 'google_map_api',
|
||||
'std' => '',
|
||||
'type' => 'text',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Maintenance Mode',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Maintenance Mode',
|
||||
'id' => 'maintenance_mode',
|
||||
'desc' => 'Enable Maintenance Mode for all users except admins.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Admin Notice',
|
||||
'id' => 'maintenance_mode_admin_notice',
|
||||
'desc' => 'Show admin notice when Maintenance Mode is enabled.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Custom Maintenance Page',
|
||||
'id' => 'maintenance_mode_page',
|
||||
'desc' => 'Set a custom page as maintenance page. Only this page will be visible for visitors.',
|
||||
'std' => 0,
|
||||
'type' => 'select',
|
||||
'options' => $of_pages,
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Maintenance Mode Text',
|
||||
'desc' => 'The text that will be visible to your customers when accessing maintenance screen.',
|
||||
'id' => 'maintenance_mode_text',
|
||||
'std' => 'Please check back soon..',
|
||||
'type' => 'text',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '404 Page',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Custom 404 Block',
|
||||
'id' => '404_block',
|
||||
'desc' => 'Replace 404 page content with a Custom Block that you can edit in the Page Builder.',
|
||||
'std' => 0,
|
||||
'type' => 'select',
|
||||
'options' => flatsome_get_block_list_by_id( array( 'option_none' => '-- None --' ) ),
|
||||
);
|
||||
|
||||
if ( is_woocommerce_activated() ) {
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'WooCommerce',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Variation swatches',
|
||||
'id' => 'swatches',
|
||||
'desc' => 'Enable variation swatches.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable Reviews Global',
|
||||
'id' => 'disable_reviews',
|
||||
'desc' => 'Disable reviews globally.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Enable default WooCommerce product gallery',
|
||||
'id' => 'product_gallery_woocommerce',
|
||||
'desc' => 'Use the default WooCommerce gallery slider for plugin compatibility, such as "Additional Variation Images".',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Shop header',
|
||||
'desc' => 'Enter HTML that should be placed on top of main shop page. Shortcodes are allowed. ',
|
||||
'id' => 'html_shop_page',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Additional Global tab/section title',
|
||||
'id' => 'tab_title',
|
||||
'std' => '',
|
||||
'type' => 'text',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Additional Global tab/section content',
|
||||
'id' => 'tab_content',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
'desc' => 'Add additional tab content here... Like Size Charts etc.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'HTML before Add To Cart button (Global)',
|
||||
'desc' => 'Enter HTML and shortcodes that will show before Add to cart selections.',
|
||||
'id' => 'html_before_add_to_cart',
|
||||
'std' => ' ',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'HTML after Add To Cart button (Global)',
|
||||
'desc' => 'Enter HTML and shortcodes that will show after Add to cart button.',
|
||||
'id' => 'html_after_add_to_cart',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Thank You Page Content / Scripts',
|
||||
'desc' => 'Enter scripts or custom HTML content for the thank you page here',
|
||||
'id' => 'html_thank_you',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Catalog Mode',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Enable catalog mode',
|
||||
'id' => 'catalog_mode',
|
||||
'desc' => 'Enable catalog mode. This will disable Add To Cart buttons / Checkout and Shopping cart.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Disable prices',
|
||||
'id' => 'catalog_mode_prices',
|
||||
'desc' => 'Select to disable prices on category pages and product page.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Remove sale badge',
|
||||
'id' => 'catalog_mode_sale_badge',
|
||||
'desc' => 'Select to remove sale badges.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Cart / Account replacement (header)',
|
||||
'id' => 'catalog_mode_header',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
'desc' => "Enter content you want to display instead of Account / Cart. Shortcodes are allowed. For search box enter <b>[search]</b>. For social icons enter: <b>[follow twitter='http://' facebook='http://' email='post@email.com' pinterest='http://']</b>",
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Add to cart replacement - Product page',
|
||||
'id' => 'catalog_mode_product',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
'desc' => 'Enter contact information or enquiry form shortcode here.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Add to cart replacement - Product Quick View',
|
||||
'id' => 'catalog_mode_lightbox',
|
||||
'std' => '',
|
||||
'type' => 'textarea',
|
||||
'desc' => 'Enter text that will show in product quick view',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Infinite Scroll',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Infinite scroll category/products',
|
||||
'id' => 'flatsome_infinite_scroll',
|
||||
'desc' => 'Enable infinite scroll for WooCommerce category/product archive.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Loading type',
|
||||
'id' => 'infinite_scroll_loader_type',
|
||||
'desc' => 'Select loading type animation or on button click.',
|
||||
'std' => 'spinner',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'button' => 'Button (On click)',
|
||||
'spinner' => 'Spinner',
|
||||
'image' => 'Custom Image',
|
||||
),
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Custom loader image',
|
||||
'desc' => "Upload or choose a custom loader image (for loading type 'Custom Image').",
|
||||
'id' => 'infinite_scroll_loader_img',
|
||||
'std' => '',
|
||||
'type' => 'upload',
|
||||
);
|
||||
}
|
||||
|
||||
// Portfolio.
|
||||
$of_options[] = array(
|
||||
'name' => 'Portfolio',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Enable Portfolio',
|
||||
'id' => 'fl_portfolio',
|
||||
'desc' => 'Enable portfolio',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
// Mobile.
|
||||
$of_options[] = array(
|
||||
'name' => 'Mobile',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Parallax Mobile Support',
|
||||
'id' => 'parallax_mobile',
|
||||
'desc' => 'Enable parallax for mobile devices',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
// Integrations.
|
||||
$of_options[] = array(
|
||||
'name' => 'Integrations',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'type' => 'info',
|
||||
'desc' => '<p style="font-size:14px">Additional options for integrated plugins will be shown here if they are activated.</p>',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Flatsome Studio',
|
||||
'id' => 'flatsome_studio',
|
||||
'desc' => 'Enable access to Flatsome Studio in UX Builder',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
|
||||
if ( function_exists( 'ubermenu' ) ) {
|
||||
$of_options[] = array(
|
||||
'name' => 'Ubermenu',
|
||||
'id' => 'flatsome_uber_menu',
|
||||
'desc' => 'Enable full width UberMenu. You can also insert this elsewhere by using the UberMenu options.',
|
||||
'std' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
}
|
||||
|
||||
// Yoast options.
|
||||
if ( class_exists( 'WPSEO_Options' ) ) {
|
||||
$of_options[] = array(
|
||||
'name' => 'Yoast Primary Category',
|
||||
'id' => 'wpseo_primary_term',
|
||||
'desc' => 'Use on product category pages and elements.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'id' => 'wpseo_manages_product_layout_priority',
|
||||
'desc' => 'Manage custom product layout priority.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Yoast Breadcrumbs',
|
||||
'id' => 'wpseo_breadcrumb',
|
||||
'desc' => 'Use on product category pages, single product pages and elements.',
|
||||
'std' => 0,
|
||||
'folds' => 1,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'id' => 'wpseo_breadcrumb_remove_last',
|
||||
'desc' => 'Remove the last static crumb on single product pages (product title).',
|
||||
'std' => 1,
|
||||
'fold' => 'wpseo_breadcrumb',
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
}
|
||||
|
||||
// Rank Math options.
|
||||
if ( class_exists( 'RankMath' ) ) {
|
||||
$of_options[] = array(
|
||||
'name' => 'Rank Math Primary Category',
|
||||
'id' => 'rank_math_primary_term',
|
||||
'desc' => 'Use on product category pages and elements.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => '',
|
||||
'id' => 'rank_math_manages_product_layout_priority',
|
||||
'desc' => 'Manage custom product layout priority.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Rank Math Breadcrumbs',
|
||||
'id' => 'rank_math_breadcrumb',
|
||||
'desc' => 'Use on product category pages, single product pages and elements.',
|
||||
'std' => 0,
|
||||
'type' => 'checkbox',
|
||||
);
|
||||
}
|
||||
|
||||
// Backup Options.
|
||||
$of_options[] = array(
|
||||
'name' => 'Backup and Import',
|
||||
'type' => 'heading',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Backup and Restore Options',
|
||||
'id' => 'of_backup',
|
||||
'std' => '',
|
||||
'type' => 'backup',
|
||||
'desc' => 'You can use the two buttons below to backup your current options, and then restore it back at a later time. This is useful if you want to experiment on the options but would like to keep the old settings in case you need it back.',
|
||||
);
|
||||
|
||||
$of_options[] = array(
|
||||
'name' => 'Transfer Theme Options Data',
|
||||
'id' => 'of_transfer',
|
||||
'std' => '',
|
||||
'type' => 'transfer',
|
||||
'desc' => 'You can transfer the saved options data between different installs by copying the text inside the text box. To import data from another install, replace the data in the text box with the one from another install and click "Import Options".',
|
||||
);
|
||||
|
||||
} // End of 'of_options()' function.
|
||||
} // End check if function exists: of_options()
|
Reference in New Issue
Block a user