; if (($handle = fopen("php://temp/maxmemory:$fiveMBs", 'r+')) !== FALSE) { fputs($handle, $input); rewind($handle); $line = -1; $return = Array(); /* add dynamic row limit, * @since: 1.0 */ $option = get_option('easy_table_plugin_option'); $limit = !empty($option['limit']) ? (int)$option['limit'] : 2000000; while (($data = @fgetcsv( $handle, $limit, $delimiter, $enclosure )) !== FALSE) { $num = count($data); for ($c=0; $c < $num; $c++) { $line++; $data[$c] = str_replace('NLINEBREAK',"\n",$data[$c]); $data[$c] = str_replace('RLINEBREAK',"\r",$data[$c]); $data[$c] = str_replace('_ESCAPED_SEPATATOR_',$delimiter,$data[$c]); $return[$line] = $data[$c]; } } fclose($handle); return $return; } } } if(!function_exists('array_replace')) { function array_replace(){ $array=array(); $n=func_num_args(); while ($n-- >0) { $array+=func_get_arg($n); } return $array; } }found. * * @param string $template_path * @return string */ public static function locate_template_url($template_path){ if( file_exists(get_stylesheet_directory().'/plugins/login-with-ajax/login-with-ajax.js') ){ //Child Theme (or just theme) return trailingslashit(get_stylesheet_directory_uri())."plugins/login-with-ajax/$template_path"; }else if( file_exists(get_template_directory().'/plugins/login-with-ajax/login-with-ajax.js') ){ //Parent Theme (if parent exists) return trailingslashit(get_template_directory_uri())."plugins/login-with-ajax/$template_path"; } //Default file in plugin folder return trailingslashit(plugin_dir_url(__FILE__))."widget/$template_path"; } //Checks a directory for folders and populates the template file public static function find_templates($dir){ if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if(is_dir($dir . $file) && $file != '.' && $file != '..' && $file != '.svn'){ //Template dir found, add it to the template array self::$templates[$file] = path_join($dir, $file); } } closedir($dh); } } } /** * Add template link and JSON callback var to the URL * @param string $content * @return string */ public static function template_link( $content ){ return add_query_arg(array('template'=>self::$template), $content); } /** * Returns a sanitized JSONP response from an array * @param array $array * @return string */ public static function json_encode($array){ $return = json_encode($array); if( isset($_REQUEST['callback']) && preg_match("/^jQuery[_a-zA-Z0-9]+$/", $_REQUEST['callback']) ){ $return = $_REQUEST['callback']."($return)"; } return $return; } } //Set when to init this class add_action( 'init', 'LoginWithAjax::init' ); add_action( 'widgets_init', 'LoginWithAjax::widgets_init' ); //Add translation function lwa_load_plugin_textdomain(){ load_plugin_textdomain('login-with-ajax', false, "login-with-ajax/langs"); } add_action('plugins_loaded','lwa_load_plugin_textdomain'); //Include admin file if needed if(is_admin()){ include_once('login-with-ajax-admin.php'); } //Include pluggable functions file if user specifies in settings $lwa_data = get_option('lwa_data'); if( !empty($lwa_data['notification_override']) ){ include_once('pluggable.php'); } //Template Tag function login_with_ajax($atts = ''){ if( !array($atts) ) $atts = shortcode_parse_atts($atts); echo LoginWithAjax::shortcode($atts); } ?>e_once( MEMBERS_INCLUDES . 'shortcodes.php' ); /* Load the template functions. */ require_once( MEMBERS_INCLUDES . 'template.php' ); /* Load the widgets functions file. */ require_once( MEMBERS_INCLUDES . 'widgets.php' ); } /** * Loads the translation files. * * @since 0.2.0 */ function i18n() { /* Load the translation of the plugin. */ load_plugin_textdomain( 'members', false, 'members/languages' ); } /** * Loads the admin functions and files. * * @since 0.2.0 */ function admin() { /* Only load files if in the WordPress admin. */ if ( is_admin() ) { /* Load the main admin file. */ require_once( MEMBERS_ADMIN . 'admin.php' ); /* Load the plugin settings. */ require_once( MEMBERS_ADMIN . 'settings.php' ); } } /** * Method that runs only when the plugin is activated. * * @since 0.2.0 */ function activation() { /* Get the administrator role. */ $role = get_role( 'administrator' ); /* If the administrator role exists, add required capabilities for the plugin. */ if ( !empty( $role ) ) { /* Role management capabilities. */ $role->add_cap( 'list_roles' ); $role->add_cap( 'create_roles' ); $role->add_cap( 'delete_roles' ); $role->add_cap( 'edit_roles' ); /* Content permissions capabilities. */ $role->add_cap( 'restrict_content' ); } /** * If the administrator role does not exist for some reason, we have a bit of a problem * because this is a role management plugin and requires that someone actually be able to * manage roles. So, we're going to create a custom role here. The site administrator can * assign this custom role to any user they wish to work around this problem. We're only * doing this for single-site installs of WordPress. The 'super admin' has permission to do * pretty much anything on a multisite install. */ elseif ( empty( $role ) && !is_multisite() ) { /* Add the 'members_role_manager' role with limited capabilities. */ add_role( 'members_role_manager', _x( 'Role Manager', 'role', 'members' ), array( 'read' => true, 'list_roles' => true, 'edit_roles' => true ) ); } } } $members_load = new Members_Load(); ?>