Redux Framework is not installed. Please install it.
';
return;
}
if ( isset( self::$uses_extensions[ $opt_name ] ) && ! empty( self::$uses_extensions[ $opt_name ] ) ) {
add_action( "redux/extensions/{$opt_name}/before", array( 'Redux', 'loadExtensions' ), 0 );
}
$redux = new ReduxFramework( $sections, $args );
$redux->apiHasRun = 1;
self::$init[ $opt_name ] = 1;
if ( isset( $redux->args['opt_name'] ) && $redux->args['opt_name'] != $opt_name ) {
self::$init[ $redux->args['opt_name'] ] = 1;
}
}
public static function createRedux() {
foreach ( self::$sections as $opt_name => $theSections ) {
if ( ! self::$init[ $opt_name ] ) {
self::loadRedux( $opt_name );
}
}
}
public static function constructArgs( $opt_name ) {
$args = isset( self::$args[ $opt_name ] ) ? self::$args[ $opt_name ] : array();
$args['opt_name'] = $opt_name;
if ( ! isset( $args['menu_title'] ) ) {
$args['menu_title'] = ucfirst( $opt_name ) . ' Options';
}
if ( ! isset( $args['page_title'] ) ) {
$args['page_title'] = ucfirst( $opt_name ) . ' Options';
}
if ( ! isset( $args['page_slug'] ) ) {
$args['page_slug'] = $opt_name . '_options';
}
return $args;
}
public static function constructSections( $opt_name ) {
$sections = array();
if ( ! isset( self::$sections[ $opt_name ] ) ) {
return $sections;
}
foreach ( self::$sections[ $opt_name ] as $section_id => $section ) {
$section['fields'] = self::constructFields( $opt_name, $section_id );
$p = $section['priority'];
while ( isset( $sections[ $p ] ) ) {
$p++;
}
$sections[ $p ] = $section;
}
ksort( $sections );
return $sections;
}
public static function constructFields( $opt_name = "", $section_id = "" ) {
$fields = array();
if ( ! empty( self::$fields[ $opt_name ] ) ) {
foreach ( self::$fields[ $opt_name ] as $key => $field ) {
if ( $field['section_id'] == $section_id ) {
$p = $field['priority'];
while ( isset( $fields[ $p ] ) ) {
echo $p ++;
}
$fields[ $p ] = $field;
}
}
}
ksort( $fields );
return $fields;
}
public static function getSection( $opt_name = '', $id = '' ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $id ) ) {
if ( ! isset( self::$sections[ $opt_name ][ $id ] ) ) {
$id = strtolower( sanitize_html_class( $id ) );
}
return isset( self::$sections[ $opt_name ][ $id ] ) ? self::$sections[ $opt_name ][ $id ] : false;
}
return false;
}
public static function setSections( $opt_name = '', $sections = array() ) {
self::check_opt_name( $opt_name );
if ( ! empty( $sections ) ) {
foreach ( $sections as $section ) {
Redux::setSection( $opt_name, $section );
}
}
}
public static function getSections( $opt_name = '' ) {
self::check_opt_name( $opt_name );
if ( ! empty( self::$sections[ $opt_name ] ) ) {
return self::$sections[ $opt_name ];
}
return array();
}
public static function removeSection( $opt_name = '', $id = "", $fields = false ) {
if ( ! empty( $opt_name ) && ! empty( $id ) ) {
if ( isset( self::$sections[ $opt_name ][ $id ] ) ) {
$priority = '';
foreach ( self::$sections[ $opt_name ] as $key => $section ) {
if ( $key == $id ) {
$priority = $section['priority'];
self::$priority[ $opt_name ]['sections'] --;
unset( self::$sections[ $opt_name ][ $id ] );
continue;
}
if ( $priority != "" ) {
$newPriority = $section['priority'];
$section['priority'] = $priority;
self::$sections[ $opt_name ][ $key ] = $section;
$priority = $newPriority;
}
}
if ( isset( self::$fields[ $opt_name ] ) && ! empty( self::$fields[ $opt_name ] ) && $fields == true ) {
foreach ( self::$fields[ $opt_name ] as $key => $field ) {
if ( $field['section_id'] == $id ) {
unset( self::$fields[ $opt_name ][ $key ] );
}
}
}
}
}
}
public static function setSection( $opt_name = '', $section = array() ) {
self::check_opt_name( $opt_name );
if ( empty( $section ) ) {
return;
}
if ( ! isset( $section['id'] ) ) {
if ( isset( $section['type'] ) && $section['type'] == "divide" ) {
$section['id'] = time();
} else {
if ( isset( $section['title'] ) ) {
$section['id'] = strtolower( sanitize_title( $section['title'] ) );
} else {
$section['id'] = time();
}
}
if ( ! isset( $section['id'] ) ) {
print_r( $section );
echo "DOVY";
}
if ( isset( self::$sections[ $opt_name ][ $section['id'] ] ) ) {
$orig = $section['id'];
$i = 0;
while ( isset( self::$sections[ $opt_name ][ $section['id'] ] ) ) {
$section['id'] = $orig . '_' . $i;
}
}
}
if ( ! empty( $opt_name ) && is_array( $section ) && ! empty( $section ) ) {
if ( ! isset( $section['id'] ) && ! isset( $section['title'] ) ) {
self::$errors[ $opt_name ]['section']['missing_title'] = "Unable to create a section due to missing id and title.";
return;
}
if ( ! isset( $section['priority'] ) ) {
$section['priority'] = self::getPriority( $opt_name, 'sections' );
}
if ( isset( $section['fields'] ) ) {
if ( ! empty( $section['fields'] ) && is_array( $section['fields'] ) ) {
self::processFieldsArray( $opt_name, $section['id'], $section['fields'] );
}
unset( $section['fields'] );
}
self::$sections[ $opt_name ][ $section['id'] ] = $section;
} else {
self::$errors[ $opt_name ]['section']['empty'] = "Unable to create a section due an empty section array or the section variable passed was not an array.";
return;
}
}
public static function hideSection( $opt_name = '', $id = '', $hide = true ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $id ) ) {
if ( isset ( self::$sections[ $opt_name ][ $id ] ) ) {
self::$sections[ $opt_name ][ $id ]['hidden'] = $hide;
}
}
}
public static function processFieldsArray( $opt_name = "", $section_id = "", $fields = array() ) {
if ( ! empty( $opt_name ) && ! empty( $section_id ) && is_array( $fields ) && ! empty( $fields ) ) {
foreach ( $fields as $field ) {
if ( ! is_array( $field ) ) {
continue;
}
$field['section_id'] = $section_id;
self::setField( $opt_name, $field );
}
}
}
public static function getField( $opt_name = '', $id = '' ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $id ) ) {
return isset( self::$fields[ $opt_name ][ $id ] ) ? self::$fields[ $opt_name ][ $id ] : false;
}
return false;
}
public static function hideField( $opt_name = '', $id = '', $hide = true ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $id ) ) {
if ( isset ( self::$fields[ $opt_name ][ $id ] ) ) {
if ( ! $hide ) {
self::$fields[ $opt_name ][ $id ]['class'] = str_replace( 'hidden', '', self::$fields[ $opt_name ][ $id ]['class'] );
} else {
self::$fields[ $opt_name ][ $id ]['class'] .= 'hidden';
}
}
}
}
public static function setField( $opt_name = '', $field = array() ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && is_array( $field ) && ! empty( $field ) ) {
if ( ! isset( $field['priority'] ) ) {
$field['priority'] = self::getPriority( $opt_name, 'fields' );
}
if ( isset( $field['id'] ) ) {
self::$fields[ $opt_name ][ $field['id'] ] = $field;
}
}
}
public static function removeField( $opt_name = '', $id = '' ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $id ) ) {
if ( isset( self::$fields[ $opt_name ][ $id ] ) ) {
foreach ( self::$fields[ $opt_name ] as $key => $field ) {
if ( $key == $id ) {
$priority = $field['priority'];
self::$priority[ $opt_name ]['fields'] --;
unset( self::$fields[ $opt_name ][ $id ] );
continue;
}
if ( isset( $priority ) && $priority != "" ) {
$newPriority = $field['priority'];
$field['priority'] = $priority;
self::$fields[ $opt_name ][ $key ] = $field;
$priority = $newPriority;
}
}
}
}
return false;
}
public static function setHelpTab( $opt_name = "", $tab = array() ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $tab ) ) {
if ( ! isset( self::$args[ $opt_name ]['help_tabs'] ) ) {
self::$args[ $opt_name ]['help_tabs'] = array();
}
if ( isset( $tab['id'] ) ) {
self::$args[ $opt_name ]['help_tabs'][] = $tab;
} else if ( is_array( end( $tab ) ) ) {
foreach ( $tab as $tab_item ) {
self::$args[ $opt_name ]['help_tabs'][] = $tab_item;
}
}
}
}
public static function setHelpSidebar( $opt_name = "", $content = "" ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $content ) ) {
self::$args[ $opt_name ]['help_sidebar'] = $content;
}
}
public static function setArgs( $opt_name = "", $args = array() ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $args ) && is_array( $args ) ) {
if ( isset( self::$args[ $opt_name ] ) && isset( self::$args[ $opt_name ]['clearArgs'] ) ) {
self::$args[ $opt_name ] = array();
}
self::$args[ $opt_name ] = wp_parse_args( $args, self::$args[ $opt_name ] );
}
}
public static function getArgs( $opt_name = "" ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( self::$args[ $opt_name ] ) ) {
return self::$args[ $opt_name ];
}
}
public static function getArg( $opt_name = "", $key = "" ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $key ) && ! empty( self::$args[ $opt_name ] ) ) {
return self::$args[ $opt_name ][ $key ];
} else {
return;
}
}
public static function getOption( $opt_name = "", $key = "" ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $key ) ) {
$redux = get_option( $opt_name );
if ( isset( $redux[ $key ] ) ) {
return $redux[ $key ];
} else {
return;
}
} else {
return;
}
}
public static function setOption( $opt_name = "", $key = "", $option = "" ) {
self::check_opt_name( $opt_name );
if ( ! empty( $opt_name ) && ! empty( $key ) ) {
$redux = get_option( $opt_name );
$redux[ $key ] = $option;
return update_option( $opt_name, $redux );
} else {
return false;
}
}
public static function getPriority( $opt_name, $type ) {
$priority = self::$priority[ $opt_name ][ $type ];
self::$priority[ $opt_name ][ $type ] += 1;
return $priority;
}
public static function check_opt_name( $opt_name = "" ) {
if ( empty( $opt_name ) || is_array( $opt_name ) ) {
return;
}
if ( ! isset( self::$sections[ $opt_name ] ) ) {
self::$sections[ $opt_name ] = array();
self::$priority[ $opt_name ]['sections'] = 1;
}
if ( ! isset( self::$args[ $opt_name ] ) ) {
self::$args[ $opt_name ] = array();
self::$priority[ $opt_name ]['args'] = 1;
}
if ( ! isset( self::$fields[ $opt_name ] ) ) {
self::$fields[ $opt_name ] = array();
self::$priority[ $opt_name ]['fields'] = 1;
}
if ( ! isset( self::$help[ $opt_name ] ) ) {
self::$help[ $opt_name ] = array();
self::$priority[ $opt_name ]['help'] = 1;
}
if ( ! isset( self::$errors[ $opt_name ] ) ) {
self::$errors[ $opt_name ] = array();
}
if ( ! isset( self::$init[ $opt_name ] ) ) {
self::$init[ $opt_name ] = false;
}
}
/**
* Retrieve metadata from a file. Based on WP Core's get_file_data function
*
* @since 2.1.1
*
* @param string $file Path to the file
*
* @return string
*/
public static function getFileVersion( $file ) {
$data = get_file_data( $file, array( 'version' ), 'plugin' );
return $data[0];
}
public static function checkExtensionClassFile( $opt_name, $name = "", $class_file = "", $instance = "" ) {
if ( file_exists( $class_file ) ) {
self::$uses_extensions[ $opt_name ] = isset( self::$uses_extensions[ $opt_name ] ) ? self::$uses_extensions[ $opt_name ] : array();
if ( ! in_array( $name, self::$uses_extensions[ $opt_name ] ) ) {
self::$uses_extensions[ $opt_name ][] = $name;
}
self::$extensions[ $name ] = isset( self::$extensions[ $name ] ) ? self::$extensions[ $name ] : array();
$version = Redux_Helpers::get_template_version( $class_file );
if ( empty( $version ) && ! empty( $instance ) ) {
if ( isset( $instance->version ) ) {
$version = $instance->version;
}
}
self::$extensions[ $name ][ $version ] = isset( self::$extensions[ $name ][ $version ] ) ? self::$extensions[ $name ][ $version ] : $class_file;
$api_check = str_replace( 'extension_' . $name, $name . '_api', $class_file );
if ( file_exists( $api_check ) && ! class_exists( 'Redux_' . ucfirst( $name ) ) ) {
include_once( $api_check );
}
}
}
public static function setExtensions( $opt_name, $path ) {
if ( is_dir( $path ) ) {
$path = trailingslashit( $path );
$folder = str_replace( '.php', '', basename( $path ) );
if ( file_exists( $path . 'extension_' . $folder . '.php' ) ) {
self::checkExtensionClassFile( $opt_name, $folder, $path . 'extension_' . $folder . '.php' );
} else {
$folders = scandir( $path, 1 );
foreach ( $folders as $folder ) {
if ( $folder === '.' or $folder === '..' ) {
continue;
}
if ( file_exists( $path . $folder . '/extension_' . $folder . '.php' ) ) {
self::checkExtensionClassFile( $opt_name, $folder, $path . $folder . '/extension_' . $folder . '.php' );
} else if ( is_dir( $path . $folder ) ) {
self::setExtensions( $opt_name, $path . $folder );
continue;
}
}
}
} else if ( file_exists( $path ) ) {
$name = explode( 'extension_', basename( $path ) );
if ( isset( $name[1] ) && ! empty( $name[1] ) ) {
$name = str_replace( '.php', '', $name[1] );
self::checkExtensionClassFile( $opt_name, $name, $path );
}
}
}
public static function getAllExtensions() {
$redux = ReduxFrameworkInstances::get_all_instances();
foreach ( $redux as $instance ) {
if ( ! empty( self::$uses_extensions[ $instance['args']['opt_name'] ] ) ) {
continue;
}
if ( ! empty( $instance['extensions'] ) ) {
Redux::getInstanceExtensions( $instance['args']['opt_name'], $instance );
}
}
}
public static function getInstanceExtensions( $opt_name, $instance = array() ) {
if ( ! empty( self::$uses_extensions[ $opt_name ] ) ) {
return;
}
if ( empty( $instance ) ) {
$instance = ReduxFrameworkInstances::get_instance( $opt_name );
}
if ( empty( $instance ) || empty( $instance->extensions ) ) {
return;
}
foreach ( $instance->extensions as $name => $extension ) {
if ( $name == "widget_areas" ) {
$new = new Redux_Widget_Areas( $instance );
}
if ( isset( self::$uses_extensions[ $opt_name ][ $name ] ) ) {
continue;
}
if ( isset( $extension->extension_dir ) ) {
Redux::setExtensions( $opt_name, str_replace( $name, '', $extension->extension_dir ) );
} else if ( isset( $extension->_extension_dir ) ) {
Redux::setExtensions( $opt_name, str_replace( $name, '', $extension->_extension_dir ) );
}
}
}
public static function getExtensions( $opt_name = "", $key = "" ) {
if ( empty( $opt_name ) ) {
Redux::getAllExtensions();
if ( empty( $key ) ) {
return self::$extension_paths;
} else {
if ( isset( self::$extension_paths[ $key ] ) ) {
return self::$extension_paths[ $key ];
}
}
} else {
if ( empty( self::$uses_extensions[ $opt_name ] ) ) {
Redux::getInstanceExtensions( $opt_name );
}
if ( empty( self::$uses_extensions[ $opt_name ] ) ) {
return false;
}
$instanceExtensions = array();
foreach ( self::$uses_extensions[ $opt_name ] as $extension ) {
$class_file = end( self::$extensions[ $extension ] );
$name = str_replace( '.php', '', basename( $extension ) );
$extension_class = 'ReduxFramework_Extension_' . $name;
$instanceExtensions[ $extension ] = array(
'path' => $class_file,
'class' => $extension_class,
'version' => Redux_Helpers::get_template_version( $class_file )
);
}
return $instanceExtensions;
}
return false;
}
}
Redux::load();
}
class.redux_cdn.php 0000666 00000017503 15214156110 0010342 0 ustar 00 args['dev_mode'] ) {
$msg = sprintf( __( 'If you are developing offline, please download and install the Redux Vendor Support plugin/extension to bypass the our CDN and avoid this warning', 'redux-framework' ), 'https://github.com/reduxframework/redux-vendor-support' );
}
self::$_parent->admin_notices[] = array(
'type' => 'error',
'msg' => '' . __( 'Redux Framework Warning', 'redux-framework' ) . ' ' . sprintf( __( '%s CDN unavailable. Some controls may not render properly.', 'redux-framework' ), $handle ) . ' ' . $msg,
'id' => $handle . $tran_key,
'dismiss' => false,
);
}
}
} else {
set_transient( $handle . $tran_key, true, MINUTE_IN_SECONDS * self::$_parent->args['cdn_check_time'] );
if ( $register ) {
self::_register( $handle, $src_cdn, $deps, $ver, $footer_or_media, $is_script );
} else {
self::_enqueue( $handle, $src_cdn, $deps, $ver, $footer_or_media, $is_script );
}
}
}
}
private static function _vendor_plugin( $register = true, $handle, $src_cdn, $deps, $ver, $footer_or_media, $is_script = true ) {
if ( class_exists( 'Redux_VendorURL' ) ) {
$src = Redux_VendorURL::get_url( $handle );
if ( $register ) {
self::_register( $handle, $src, $deps, $ver, $footer_or_media, $is_script );
} else {
self::_enqueue( $handle, $src, $deps, $ver, $footer_or_media, $is_script );
}
} else {
if ( ! self::$_set ) {
self::$_parent->admin_notices[] = array(
'type' => 'error',
'msg' => sprintf( __( 'The Vendor Support plugin (or extension) is either not installed or not activated and thus, some controls may not render properly. Please ensure that it is installed and activated', 'redux-framework' ), 'https://github.com/reduxframework/redux-vendor-support', admin_url( 'plugins.php' ) ),
'id' => $handle . '23',
'dismiss' => false,
);
self::$_set = true;
}
}
}
public static function register_style( $handle, $src_cdn = false, $deps = array(), $ver = false, $media = 'all' ) {
if ( self::$_parent->args['use_cdn'] ) {
self::_cdn( true, $handle, $src_cdn, $deps, $ver, $media, $is_script = false );
} else {
self::_vendor_plugin( true, $handle, $src_cdn, $deps, $ver, $media, $is_script = false );
}
}
public static function register_script( $handle, $src_cdn = false, $deps = array(), $ver = false, $in_footer = false ) {
if ( self::$_parent->args['use_cdn'] ) {
self::_cdn( true, $handle, $src_cdn, $deps, $ver, $in_footer, $is_script = true );
} else {
self::_vendor_plugin( true, $handle, $src_cdn, $deps, $ver, $in_footer, $is_script = true );
}
}
public static function enqueue_style( $handle, $src_cdn = false, $deps = array(), $ver = false, $media = 'all' ) {
if ( self::$_parent->args['use_cdn'] ) {
self::_cdn( false, $handle, $src_cdn, $deps, $ver, $media, $is_script = false );
} else {
self::_vendor_plugin( false, $handle, $src_cdn, $deps, $ver, $media, $is_script = false );
}
}
public static function enqueue_script( $handle, $src_cdn = false, $deps = array(), $ver = false, $in_footer = false ) {
if ( self::$_parent->args['use_cdn'] ) {
self::_cdn( false, $handle, $src_cdn, $deps, $ver, $in_footer, $is_script = true );
} else {
self::_vendor_plugin( false, $handle, $src_cdn, $deps, $ver, $in_footer, $is_script = true );
}
}
}
}
class.p.php 0000666 00000026246 15214156110 0006632 0 ustar 00 and
// are disabled by default, see for more information.
// callback - If specified, the response JSON will be wrapped in this named
// function call. This parameter and are disabled by
// default, see for more information.
// user_agent - This value will be sent to the remote URL request as the
// `User-Agent:` HTTP request header. If omitted, the browser user agent
// will be passed through.
// send_cookies - If send_cookies=1, all cookies will be forwarded through to
// the remote URL request.
// send_session - If send_session=1 and send_cookies=1, the SID cookie will be
// forwarded through to the remote URL request.
// full_headers - If a JSON request and full_headers=1, the JSON response will
// contain detailed header information.
// full_status - If a JSON request and full_status=1, the JSON response will
// contain detailed cURL status information, otherwise it will just contain
// the `http_code` property.
//
// Topic: POST Parameters
//
// All POST parameters are automatically passed through to the remote URL
// request.
//
// Topic: JSON requests
//
// This request will return the contents of the specified url in JSON format.
//
// Request:
//
// > ba-simple-proxy.php?url=http://example.com/
//
// Response:
//
// > { "contents": "...", "headers": {...}, "status": {...} }
//
// JSON object properties:
//
// contents - (String) The contents of the remote URL resource.
// headers - (Object) A hash of HTTP headers returned by the remote URL
// resource.
// status - (Object) A hash of status codes returned by cURL.
//
// Topic: JSONP requests
//
// This request will return the contents of the specified url in JSONP format
// (but only if $enable_jsonp is enabled in the PHP script).
//
// Request:
//
// > ba-simple-proxy.php?url=http://example.com/&callback=foo
//
// Response:
//
// > foo({ "contents": "...", "headers": {...}, "status": {...} })
//
// JSON object properties:
//
// contents - (String) The contents of the remote URL resource.
// headers - (Object) A hash of HTTP headers returned by the remote URL
// resource.
// status - (Object) A hash of status codes returned by cURL.
//
// Topic: Native requests
//
// This request will return the contents of the specified url in the format it
// was received in, including the same content-type and other headers (but only
// if $enable_native is enabled in the PHP script).
//
// Request:
//
// > ba-simple-proxy.php?url=http://example.com/&mode=native
//
// Response:
//
// > ...
//
// Topic: Notes
//
// * Assumes magic_quotes_gpc = Off in php.ini
//
// Topic: Configuration Options
//
// These variables can be manually edited in the PHP file if necessary.
//
// $enable_jsonp - Only enable if you really need to. If you
// install this script on the same server as the page you're calling it
// from, plain JSON will work. Defaults to false.
// $enable_native - You can enable , but you should only do
// this if you also whitelist specific URLs using $valid_url_regex, to avoid
// possible XSS vulnerabilities. Defaults to false.
// $valid_url_regex - This regex is matched against the url parameter to
// ensure that it is valid. This setting only needs to be used if either
// $enable_jsonp or $enable_native are enabled. Defaults to '/.*/' which
// validates all URLs.
//
// ############################################################################
$_GET['mode'] = "native";
$_GET['full_headers'] = 1;
$_GET['full_status'] = 1;
$_GET['send_cookies'] = 1;
// Change these configuration options if needed, see above descriptions for info.
$enable_jsonp = false;
$enable_native = true;
$valid_url_regex = '/.*/';
// ############################################################################
$url = $_GET['url'];
if ( isset( $_GET['nonce'] ) ) {
$url = str_replace( 'nonce=' . $_GET['nonce'] . '&', '', $url );
}
if ( ! $url ) {
// Passed url not specified.
$contents = 'ERROR: url not specified';
$status = array( 'http_code' => 'ERROR' );
} else if ( ! preg_match( $valid_url_regex, $url ) ) {
// Passed url doesn't match $valid_url_regex.
$contents = 'ERROR: invalid url';
$status = array( 'http_code' => 'ERROR' );
} else {
$url = urldecode( $url );
if ( isset( $_GET['proxy'] ) ) {
$url .= '&proxy=' . $_GET['proxy'];
}
// Ad URL rewrite
if ( strpos( $url, 'http' ) === false ) {
$url = 'http:' . $url;
}
if ( isset( $_GET['callback'] ) ) {
foreach ( $_GET as $key => $value ) {
if ( in_array( $key, array( 'url', 'mode', 'full_headers', 'full_status', 'send_cookies' ) ) ) {
continue;
}
$url .= "&" . $key . '=' . $value;
}
}
$args = array(
'user-agent' => isset( $_GET['user_agent'] ) ? $_GET['user_agent'] : $_SERVER['HTTP_USER_AGENT'],
'method' => 'GET',
);
if ( isset( $_GET['send_cookies'] ) && $_GET['send_cookies'] ) {
$cookie = array();
foreach ( $_COOKIE as $key => $value ) {
$cookie[] = $key . '=' . $value;
}
if ( isset( $_GET['send_session'] ) && $_GET['send_session'] ) {
$cookie[] = SID;
}
$args['cookies'] = $cookie;
}
if ( strtolower( $_SERVER['REQUEST_METHOD'] ) == 'post' ) {
$args['body'] = $_POST;
$args['method'] = 'POST';
}
$response = wp_remote_request(
$url,
$args
);
if ( ! is_wp_error( $response ) ) {
$status = $response['response']['code'];
$contents = $response['body'];
}
}
if ( isset( $_GET['mode'] ) && $_GET['mode'] == 'native' ) {
if ( ! $enable_native ) {
$contents = 'ERROR: invalid mode';
$status = array( 'http_code' => 'ERROR' );
}
if ( ! is_wp_error( $response ) && isset( $response['headers']['content-type'] ) ) {
header( 'Content-Type: ' . $response['headers']['content-type'] );
}
if ( ! is_wp_error( $response ) && isset( $response['headers']['content-language'] ) ) {
header( 'Content-Language: ' . $response['headers']['content-language'] );
}
if ( ! is_wp_error( $response ) && isset( $response['headers']['set-cookie'] ) ) {
header( 'Set-Cookie: ' . $response['headers']['set-cookie'] );
}
if ( isset( $contents ) ) {
print str_replace( 'ads.reduxframework.com', 'look.reduxframework.com', $contents );
}
} else {
// $data will be serialized into JSON data.
$data = array();
// Propagate all HTTP headers into the JSON data object.
if ( isset( $_GET['full_headers'] ) && $_GET['full_headers'] ) {
$data['headers'] = array();
}
// Propagate all cURL request / response info to the JSON data object.
if ( isset( $_GET['full_status'] ) && $_GET['full_status'] ) {
$data['status'] = $status;
} else {
$data['status'] = array();
$data['status']['http_code'] = $status['http_code'];
}
// Set the JSON data object contents, decoding it from JSON if possible.
$decoded_json = json_decode( $contents );
$data['contents'] = str_replace( 'e(window).width()', 'window.innerWidth||e(window).width()', $decoded_json ? $decoded_json : $contents );
// Generate appropriate content-type header.
$is_xhr = isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ? strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) : 'xmlhttprequest';
header( 'Content-type: application/' . ( $is_xhr ? 'json' : 'x-javascript' ) );
// Get JSONP callback.
$jsonp_callback = $enable_jsonp && isset( $_GET['callback'] ) ? $_GET['callback'] : null;
// Generate JSON/JSONP string
$json = json_encode( $data );
print $jsonp_callback ? "$jsonp_callback($json)" : $json;
}
}
}
new Redux_P();
validation/url/validation_url.php 0000666 00000002640 15214156110 0013227 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a valid URL for this option.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and validates them
*
* @since ReduxFramework 1.0.0
*/
function validate() {
if ( filter_var( $this->value, FILTER_VALIDATE_URL ) == false ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
} else {
$this->value = esc_url_raw( $this->value );
}
} //function
} //class
} validation/str_replace/validation_str_replace.php 0000666 00000002056 15214156110 0016432 0 ustar 00 parent = $parent;
$this->field = $field;
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and validates them
*
* @since ReduxFramework 1.0.0
*/
function validate() {
$this->value = str_replace( $this->field['str']['search'], $this->field['str']['replacement'], $this->value );
} //function
} //class
} validation/color/validation_color.php 0000666 00000013131 15214156110 0014054 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field must be a valid color value.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Validate Color
* Takes the user's input color value and returns it only if it's a valid color.
*
* @since ReduxFramework 3.0.0
*/
function validate_color( $color ) {
if ( $color == "transparent" ) {
return $color;
}
$named = json_decode( '{"transparent":"transparent", "aliceblue":"#f0f8ff","antiquewhite":"#faebd7","aqua":"#00ffff","aquamarine":"#7fffd4","azure":"#f0ffff", "beige":"#f5f5dc","bisque":"#ffe4c4","black":"#000000","blanchedalmond":"#ffebcd","blue":"#0000ff","blueviolet":"#8a2be2","brown":"#a52a2a","burlywood":"#deb887", "cadetblue":"#5f9ea0","chartreuse":"#7fff00","chocolate":"#d2691e","coral":"#ff7f50","cornflowerblue":"#6495ed","cornsilk":"#fff8dc","crimson":"#dc143c","cyan":"#00ffff", "darkblue":"#00008b","darkcyan":"#008b8b","darkgoldenrod":"#b8860b","darkgray":"#a9a9a9","darkgreen":"#006400","darkkhaki":"#bdb76b","darkmagenta":"#8b008b","darkolivegreen":"#556b2f", "darkorange":"#ff8c00","darkorchid":"#9932cc","darkred":"#8b0000","darksalmon":"#e9967a","darkseagreen":"#8fbc8f","darkslateblue":"#483d8b","darkslategray":"#2f4f4f","darkturquoise":"#00ced1", "darkviolet":"#9400d3","deeppink":"#ff1493","deepskyblue":"#00bfff","dimgray":"#696969","dodgerblue":"#1e90ff", "firebrick":"#b22222","floralwhite":"#fffaf0","forestgreen":"#228b22","fuchsia":"#ff00ff", "gainsboro":"#dcdcdc","ghostwhite":"#f8f8ff","gold":"#ffd700","goldenrod":"#daa520","gray":"#808080","green":"#008000","greenyellow":"#adff2f", "honeydew":"#f0fff0","hotpink":"#ff69b4", "indianred ":"#cd5c5c","indigo ":"#4b0082","ivory":"#fffff0","khaki":"#f0e68c", "lavender":"#e6e6fa","lavenderblush":"#fff0f5","lawngreen":"#7cfc00","lemonchiffon":"#fffacd","lightblue":"#add8e6","lightcoral":"#f08080","lightcyan":"#e0ffff","lightgoldenrodyellow":"#fafad2", "lightgrey":"#d3d3d3","lightgreen":"#90ee90","lightpink":"#ffb6c1","lightsalmon":"#ffa07a","lightseagreen":"#20b2aa","lightskyblue":"#87cefa","lightslategray":"#778899","lightsteelblue":"#b0c4de", "lightyellow":"#ffffe0","lime":"#00ff00","limegreen":"#32cd32","linen":"#faf0e6", "magenta":"#ff00ff","maroon":"#800000","mediumaquamarine":"#66cdaa","mediumblue":"#0000cd","mediumorchid":"#ba55d3","mediumpurple":"#9370d8","mediumseagreen":"#3cb371","mediumslateblue":"#7b68ee", "mediumspringgreen":"#00fa9a","mediumturquoise":"#48d1cc","mediumvioletred":"#c71585","midnightblue":"#191970","mintcream":"#f5fffa","mistyrose":"#ffe4e1","moccasin":"#ffe4b5", "navajowhite":"#ffdead","navy":"#000080", "oldlace":"#fdf5e6","olive":"#808000","olivedrab":"#6b8e23","orange":"#ffa500","orangered":"#ff4500","orchid":"#da70d6", "palegoldenrod":"#eee8aa","palegreen":"#98fb98","paleturquoise":"#afeeee","palevioletred":"#d87093","papayawhip":"#ffefd5","peachpuff":"#ffdab9","peru":"#cd853f","pink":"#ffc0cb","plum":"#dda0dd","powderblue":"#b0e0e6","purple":"#800080", "red":"#ff0000","rosybrown":"#bc8f8f","royalblue":"#4169e1", "saddlebrown":"#8b4513","salmon":"#fa8072","sandybrown":"#f4a460","seagreen":"#2e8b57","seashell":"#fff5ee","sienna":"#a0522d","silver":"#c0c0c0","skyblue":"#87ceeb","slateblue":"#6a5acd","slategray":"#708090","snow":"#fffafa","springgreen":"#00ff7f","steelblue":"#4682b4", "tan":"#d2b48c","teal":"#008080","thistle":"#d8bfd8","tomato":"#ff6347","turquoise":"#40e0d0", "violet":"#ee82ee", "wheat":"#f5deb3","white":"#ffffff","whitesmoke":"#f5f5f5", "yellow":"#ffff00","yellowgreen":"#9acd32"}', true );
if ( isset( $named[ strtolower( $color ) ] ) ) {
/* A color name was entered instead of a Hex Value, convert and send back */
return $named[ strtolower( $color ) ];
}
$color = str_replace( '#', '', $color );
if ( strlen( $color ) == 3 ) {
$color = $color . $color;
}
if ( preg_match( '/^[a-f0-9]{6}$/i', $color ) ) {
return '#' . $color;
}
//$this->error = $this->field;
return false;
} //function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 3.0.0
*/
function validate() {
if ( is_array( $this->value ) ) { // If array
foreach ( $this->value as $k => $value ) {
$this->value[ $k ] = $this->validate_color( $value );
}
//foreach
} else { // not array
$this->value = $this->validate_color( $this->value );
} // END array check
} //function
} //class
} validation/preg_replace/validation_preg_replace.php 0000666 00000002126 15214156110 0016702 0 ustar 00 parent = $parent;
$this->field = $field;
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and validates them
*
* @since ReduxFramework 1.0.0
*/
function validate() {
$this->value = preg_replace_callback($this->field['preg']['pattern'], function($matches){return $this->field['preg']['replacement'];}, $this->value);
} //function
} //class
} validation/no_html/validation_no_html.php 0000666 00000002535 15214156110 0014726 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must not enter any HTML in this field, all HTML tags have been removed.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and validates them
*
* @since ReduxFramework 1.0.0
*/
function validate() {
$newvalue = strip_tags( $this->value );
if ( $this->value != $newvalue ) {
$this->warning = $this->field;
}
$this->value = $newvalue;
} //function
} //class
} validation/no_special_chars/validation_no_special_chars.php 0000666 00000002631 15214156110 0020413 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must not enter any special characters in this field, all special characters have been removed.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and validates them
*
* @since ReduxFramework 1.0.0
*/
function validate() {
if ( ! preg_match( '/[^a-zA-Z0-9_ -]/s', $this->value ) == 0 ) {
$this->warning = $this->field;
}
$this->value = preg_replace( '/[^a-zA-Z0-9_ -]/s', '', $this->value );
} //function
} //class
} validation/numeric/validation_numeric.php 0000666 00000002531 15214156110 0014726 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a numerical value for this option.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 1.0.0
*/
function validate() {
if ( ! is_numeric( $this->value ) ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
}
} //function
} //class
} validation/comma_numeric/validation_comma_numeric.php 0000666 00000002734 15214156110 0017263 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a comma separated list of numerical values for this option.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 1.0.0
*/
function validate() {
$this->value = str_replace( ' ', '', $this->value );
if ( ! is_numeric( str_replace( ',', '', $this->value ) ) ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
}
} //function
} //class
} validation/email_not_empty/validation_email_not_empty.php 0000666 00000002627 15214156110 0020202 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a valid email for this option.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 1.0.0
*/
function validate() {
if ( ! is_email( $this->value ) || ! isset( $this->value ) || empty( $this->value ) ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
}
} //function
} //class
} validation/numeric_not_empty/validation_numeric_not_empty.php 0000666 00000002450 15214156110 0021122 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a numerical value for this option.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 1.0.0
*/
function validate() {
if ( ! is_numeric( $this->value ) || ! isset( $this->value ) || empty( $this->value ) ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
}
} //function
} //class
} validation/html/validation_html.php 0000666 00000001736 15214156110 0013540 0 ustar 00 parent = $parent;
$this->field = $field;
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and validates them
*
* @since ReduxFramework 1.0.0
*/
function validate() {
$this->value = wp_kses_post( $this->value );
} //function
} //class
} validation/email/validation_email.php 0000666 00000002517 15214156110 0014004 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'You must provide a valid email for this option.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 1.0.0
*/
function validate() {
if ( ! is_email( $this->value ) ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
}
} //function
} //class
} validation/css/validation_css.php 0000666 00000002626 15214156110 0013207 0 ustar 00 parent = $parent;
$this->field = $field;
$this->value = $value;
$this->current = $current;
$this->validate();
}
//function
/**
* Field Render Function.
* Takes the vars and validates them
*
* @since ReduxFramework 3.0.0
*/
function validate() {
$data = $this->value;
$data = wp_filter_nohtml_kses( $data );
$data = str_replace( '>', '>', $data );
$data = stripslashes($data);
if ($data != $this->value) {
$this->field['msg'] = __( 'Unsafe strings were found in your CSS and have been filtered out.', 'redux-framework' );
$this->warning = $this->field;
}
$this->value = $data;
} //function
} //class
} validation/not_empty/validation_not_empty.php 0000666 00000002561 15214156110 0015661 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field cannot be empty. Please provide a value.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 1.0.0
*/
function validate() {
if ( ! isset( $this->value ) || empty( $this->value ) ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
}
} //function
} //class
} validation/js/validation_js.php 0000666 00000001712 15214156110 0012652 0 ustar 00 parent = $parent;
$this->field = $field;
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and validates them
*
* @since ReduxFramework 1.0.0
*/
function validate() {
$this->value = $this->value;
} //function
} //class
} validation/html_custom/validation_html_custom.php 0000666 00000002125 15214156110 0016515 0 ustar 00 parent = $parent;
$this->field = $field;
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and validates them
*
* @since ReduxFramework 1.0.0
*/
function validate() {
if (isset($this->field['allowed_html'])) {
$this->value = wp_kses( $this->value, $this->field['allowed_html'] );
}
} //function
} //class
} validation/colorrgba/validation_colorrgba.php 0000666 00000005114 15214156110 0015546 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field must be a valid color value.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
//$this->validate();
}
//function
/**
* Validate Color to RGBA
* Takes the user's input color value and returns it only if it's a valid color.
*
* @since ReduxFramework 3.0.3
*/
function validate_colorrgba( $color ) {
return $color;
//$color = $value['color'];
//$alpha = $value['alpha'];
$alpha = '1.0';
if ( $color == "transparent" ) {
return $hidden;
}
/*
$color = str_replace('#','', $color);
if (strlen($color) == 3) {
$color = $color.$color;
}
if (preg_match('/^[a-f0-9]{6}$/i', $color)) {
$color = '#' . $color;
}
*/
return array( 'hex' => $color, 'alpha' => $alpha );
}
//function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 3.0.0
*/
function validate() {
$this->value = $this->validate_colorrgba( $this->value );
/*
if(is_array($this->value)) { // If array
foreach($this->value as $k => $value){
$this->value[$k] = $this->validate_colorrgba($value);
}//foreach
} else { // not array
$this->value = $this->validate_colorrgba($this->value);
} // END array check
*/
}
//function
}
//class
} validation/color_rgba/validation_color_rgba.php 0000666 00000004472 15214156110 0016052 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field must be a valid color value.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Validate Color to RGBA
* Takes the user's input color value and returns it only if it's a valid color.
*
* @since ReduxFramework 3.0.3
*/
function validate_color_rgba( $color ) {
if ( $color == "transparent" ) {
return $color;
}
$color = str_replace( '#', '', $color );
if ( strlen( $color ) == 3 ) {
$color = $color . $color;
}
if ( preg_match( '/^[a-f0-9]{6}$/i', $color ) ) {
$color = '#' . $color;
}
return array( 'hex' => $color, 'rgba' => Redux_Helpers::hex2rgba( $color ) );
} //function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 3.0.0
*/
function validate() {
if ( is_array( $this->value ) ) { // If array
foreach ( $this->value as $k => $value ) {
$this->value[ $k ] = $this->validate_color_rgba( $value );
}
//foreach
} else { // not array
$this->value = $this->validate_color_rgba( $this->value );
} // END array check
} //function
} //class
} validation/date/validation_date.php 0000666 00000003512 15214156110 0013454 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'This field must be a valid date.', 'redux-framework' );
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
/**
* Field Render Function.
* Takes the vars and outputs the HTML for the field in the settings
*
* @since ReduxFramework 1.0.0
*/
function validate() {
$string = str_replace( '/', '', $this->value );
if ( ! is_numeric( $string ) ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
return;
}
if ( $this->value[2] != '/' ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
return;
}
if ( $this->value[5] != '/' ) {
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->error = $this->field;
}
} //function
} //class
} validation/unique_slug/validation_unique_slug.php 0000666 00000006223 15214156110 0016524 0 ustar 00 parent = $parent;
$this->field = $field;
$this->field['msg'] = ( isset( $this->field['msg'] ) ) ? $this->field['msg'] : __( 'That URL slug is in use, please choose another. %s is open for use.', 'redux-framework' );
$this->field['flush_permalinks'] = ( isset( $this->field['flush_permalinks'] ) ) ? $this->field['flush_permalinks'] : false;
$this->value = $value;
$this->current = $current;
$this->validate();
} //function
function validate() {
global $wpdb, $wp_rewrite;
$slug = $this->value;
$feeds = $wp_rewrite->feeds;
if ( ! is_array( $feeds ) ) {
$feeds = array();
}
// Post slugs must be unique across all posts.
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s LIMIT 1";
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug ) );
/**
* Filter whether the post slug would be bad as a flat slug.
*
* @since 3.1.0
*
* @param bool $bad_slug Whether the post slug would be bad as a flat slug.
* @param string $slug The post slug.
* @param string $post_type Post type.
*/
if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
$suffix = 2;
do {
$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name ) );
$suffix ++;
} while ( $post_name_check );
$slug = $alt_post_name;
$this->value = ( isset( $this->current ) ) ? $this->current : '';
$this->field['msg'] = sprintf( $this->field['msg'], $slug );
$this->error = $this->field;
} else if ( isset( $this->field['flush_permalinks'] ) && $this->field['flush_permalinks'] == true ) {
add_action( 'init', array( $this, 'flush_permalinks' ), 99 );
}
} //function
function flush_permalinks() {
flush_rewrite_rules();
}
} //class
}
class.redux_functions.php 0000666 00000026130 15214156110 0011602 0 ustar 00 args['dev_mode'] ) {
$min = '.min';
}
return $min;
}
/**
* Sets a cookie.
* Do nothing if unit testing.
*
* @since 3.5.4
* @access public
* @return void
*
* @param string $name The cookie name.
* @param string $value The cookie value.
* @param integer $expire Expiry time.
* @param string $path The cookie path.
* @param string $domain The cookie domain.
* @param boolean $secure HTTPS only.
* @param boolean $httponly Only set cookie on HTTP calls.
*/
public static function setCookie( $name, $value, $expire = 0, $path, $domain = null, $secure = false, $httponly = false ) {
if ( ! defined( 'WP_TESTS_DOMAIN' ) ) {
setcookie( $name, $value, $expire, $path, $domain, $secure, $httponly );
}
}
/**
* Parse CSS from output/compiler array
*
* @since 3.2.8
* @access private
* @return $css CSS string
*/
public static function parseCSS( $cssArray = array(), $style = '', $value = '' ) {
// Something wrong happened
if ( count( $cssArray ) == 0 ) {
return;
} else { //if ( count( $cssArray ) >= 1 ) {
$css = '';
foreach ( $cssArray as $element => $selector ) {
// The old way
if ( $element === 0 ) {
$css = self::theOldWay( $cssArray, $style );
return $css;
}
// New way continued
$cssStyle = $element . ':' . $value . ';';
$css .= $selector . '{' . $cssStyle . '}';
}
}
return $css;
}
private static function theOldWay( $cssArray, $style ) {
$keys = implode( ",", $cssArray );
$css = $keys . "{" . $style . '}';
return $css;
}
/**
* initWpFilesystem - Initialized the Wordpress filesystem, if it already isn't.
*
* @since 3.2.3
* @access public
* @return void
*/
public static function initWpFilesystem() {
global $wp_filesystem;
// Initialize the Wordpress filesystem, no more using file_put_contents function
if ( empty( $wp_filesystem ) ) {
require_once ABSPATH . '/wp-includes/pluggable.php';
require_once ABSPATH . '/wp-admin/includes/file.php';
WP_Filesystem();
}
}
/**
* verFromGit - Retrives latest Redux version from GIT
*
* @since 3.2.0
* @access private
* @return string $ver
*/
private static function verFromGit() {
// Get the raw framework.php from github
$gitpage = wp_remote_get(
'https://raw.github.com/ReduxFramework/redux-framework/master/ReduxCore/framework.php', array(
'headers' => array(
'Accept-Encoding' => ''
),
'sslverify' => true,
'timeout' => 300
) );
// Is the response code the corect one?
if ( ! is_wp_error( $gitpage ) ) {
if ( isset( $gitpage['body'] ) ) {
// Get the page text.
$body = $gitpage['body'];
// Find version line in framework.php
$needle = 'public static $_version =';
$pos = strpos( $body, $needle );
// If it's there, continue. We don't want errors if $pos = 0.
if ( $pos > 0 ) {
// Look for the semi-colon at the end of the version line
$semi = strpos( $body, ";", $pos );
// Error avoidance. If the semi-colon is there, continue.
if ( $semi > 0 ) {
// Extract the version line
$text = substr( $body, $pos, ( $semi - $pos ) );
// Find the first quote around the veersion number.
$quote = strpos( $body, "'", $pos );
// Extract the version number
$ver = substr( $body, $quote, ( $semi - $quote ) );
// Strip off quotes.
$ver = str_replace( "'", '', $ver );
return $ver;
}
}
}
}
}
/**
* updateCheck - Checks for updates to Redux Framework
*
* @since 3.2.0
* @access public
*
* @param string $curVer Current version of Redux Framework
*
* @return void - Admin notice is diaplyed if new version is found
*/
public static function updateCheck( $curVer ) {
// If no cookie, check for new ver
if ( ! isset( $_COOKIE['redux_update_check'] ) ) { // || 1 == strcmp($_COOKIE['redux_update_check'], self::$_version)) {
// actual ver number from git repo
$ver = self::verFromGit();
// hour long cookie.
setcookie( "redux_update_check", $ver, time() + 3600, '/' );
} else {
// saved value from cookie. If it's different from current ver
// we can still show the update notice.
$ver = $_COOKIE['redux_update_check'];
}
// Set up admin notice on new version
//if ( 1 == strcmp( $ver, $curVer ) ) {
if ( version_compare( $ver, $curVer, '>' ) ) {
self::$_parent->admin_notices[] = array(
'type' => 'updated',
'msg' => 'A new build of Redux is now available!
Your version: ' . $curVer . ' New version: ' . $ver . '
If you are not a developer, your theme/plugin author shipped with dev_mode on. Contact them to fix it, but in the meantime you can use our dev_mode disabler.
This version the fastest Redux ever released. We've integrated ajax_saving as well as many other
speed improvements to make Redux even surpass the load time of SMOF even with
large panels.
The New Redux API
We've gone back to the drawing boards and made Redux the simplest framework to
use. Introducing the Redux API. Easily add fields, extensions, templates, and more without every
having to define a class! Learn More
Security Improvments
Thanks to the help of James Golovich
(Pritect), we have patched varying security flaws in Redux. This is the most secure
version of Redux yet!
Panel Templates
Now developers can easily customize the Redux panel by declaring a templates location path. We've
also made use of template versioning so if we change anything, you will know. Learn More
Full Width for ANY Field
Any field can now be set to full width! Just set the full_width argument and your
field will expand to the full width of your panel or metabox.
Elusive Icons Update
Redux is now taking over development of Elusive Icons. As a result, we've refreshed our copy of
Elusive to the newest version.