Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/themify-.../themify
File: themify-wpajax.php
if ( isset( $module['element_id'], $module['mod_settings'] ) && $module['element_id'] === $mod_id ) {
[500] Fix | Delete
$mod_setting = $module;
[501] Fix | Delete
break;
[502] Fix | Delete
}
[503] Fix | Delete
}
[504] Fix | Delete
}
[505] Fix | Delete
if(!empty($mod_setting)){
[506] Fix | Delete
global $paged;
[507] Fix | Delete
$paged=(int)$_POST['page'];
[508] Fix | Delete
$paged=$paged<1?1:$paged;
[509] Fix | Delete
if(themify_is_themify_theme() && is_file(THEME_DIR.'/theme-options.php')){
[510] Fix | Delete
require_once( THEME_DIR.'/theme-options.php' );
[511] Fix | Delete
global $themify;
[512] Fix | Delete
if(isset($themify) && method_exists($themify,'template_redirect')){
[513] Fix | Delete
$themify->template_redirect();
[514] Fix | Delete
}
[515] Fix | Delete
}
[516] Fix | Delete
Themify_Builder_Component_Module::template($mod_setting, $builder_id);
[517] Fix | Delete
}
[518] Fix | Delete
}
[519] Fix | Delete
wp_die();
[520] Fix | Delete
}
[521] Fix | Delete
// Ajax filter actions
[522] Fix | Delete
add_action('wp_ajax_nopriv_themify_ajax_load_more','themify_ajax_load_more');
[523] Fix | Delete
}
[524] Fix | Delete
[525] Fix | Delete
[526] Fix | Delete
function themify_required_plugins_modal() {
[527] Fix | Delete
check_ajax_referer( 'tf_nonce', 'nonce' );
[528] Fix | Delete
if(!current_user_can('manage_options')){
[529] Fix | Delete
wp_send_json_error(__( 'You are not allowed to import data.','themify' ));
[530] Fix | Delete
}
[531] Fix | Delete
$required_plugins = !empty($_POST['plugins'])?sanitize_text_field($_POST['plugins']):'';
[532] Fix | Delete
$result=array('plugins'=>array());
[533] Fix | Delete
if( ! empty( $required_plugins )) {
[534] Fix | Delete
$required_plugins = explode( ',', $required_plugins );
[535] Fix | Delete
$all_plugins = get_plugins();
[536] Fix | Delete
$can_install=current_user_can( 'install_plugins' ) ;
[537] Fix | Delete
$themify_updater = class_exists('Themify_Updater',false)?Themify_Updater::get_instance():null;
[538] Fix | Delete
foreach($required_plugins as $plugin){
[539] Fix | Delete
$plugin=trim($plugin);
[540] Fix | Delete
$plugin_info = themify_get_known_plugin_info($plugin);
[541] Fix | Delete
if($plugin_info!==false){
[542] Fix | Delete
if(isset($all_plugins[$plugin_info['path']])){
[543] Fix | Delete
if(is_plugin_active( $plugin_info['path'] )){
[544] Fix | Delete
$plugin_info['active']=1;
[545] Fix | Delete
}
[546] Fix | Delete
elseif(current_user_can( 'activate_plugin', $plugin )){
[547] Fix | Delete
$valid= function_exists('validate_plugin_requirements')?validate_plugin_requirements($plugin_info['path']):true;
[548] Fix | Delete
if(is_wp_error( $valid )){
[549] Fix | Delete
$plugin_info['error']=$valid->get_error_message();
[550] Fix | Delete
}
[551] Fix | Delete
else{
[552] Fix | Delete
$plugin_info['active']=0;
[553] Fix | Delete
}
[554] Fix | Delete
}
[555] Fix | Delete
else{
[556] Fix | Delete
$plugin_info['error']=__( 'You are not allowed to activate this plugin.','themify' );
[557] Fix | Delete
}
[558] Fix | Delete
}
[559] Fix | Delete
elseif($can_install===true){
[560] Fix | Delete
$plugin_info['install']=$themify_updater===null || $themify_updater->has_error() || !empty($plugin_info['wp_hosted']) || $themify_updater->has_access( $plugin )?1:'buy';
[561] Fix | Delete
}
[562] Fix | Delete
else{
[563] Fix | Delete
$plugin_info['error']= __( 'You are not allowed to install plugins on this site.' ,'themify' );
[564] Fix | Delete
[565] Fix | Delete
}
[566] Fix | Delete
unset($plugin_info['desc'],$plugin_info['image'],$plugin_info['path'],$plugin_info['wp_hosted']);
[567] Fix | Delete
$result['plugins'][$plugin]=$plugin_info;
[568] Fix | Delete
}
[569] Fix | Delete
else{
[570] Fix | Delete
$result['plugins'][$plugin]=array(
[571] Fix | Delete
'error'=> __( 'Unknown plugin.','themify' ),
[572] Fix | Delete
'name'=>$plugin
[573] Fix | Delete
);
[574] Fix | Delete
}
[575] Fix | Delete
}
[576] Fix | Delete
unset($required_plugins,$all_plugins,$can_install);
[577] Fix | Delete
}
[578] Fix | Delete
$result['labels']=array(
[579] Fix | Delete
'head'=>__( 'This demo requires these plugins/addons:', 'themify' ),
[580] Fix | Delete
'import_warning'=>__( 'Proceed import without the required addons/plugins might show incomplete/missing content.', 'themify' ),
[581] Fix | Delete
'proceed_import'=> __( 'Proceed Import', 'themify' ),
[582] Fix | Delete
'erase'=>__( 'Erase ALL previously imported demo content', 'themify' ),
[583] Fix | Delete
'modify'=> __( 'Keep modified posts/pages', 'themify' ),
[584] Fix | Delete
'builder_img'=>__('Import Builder layout images (will take longer)','themify'),
[585] Fix | Delete
'install'=>__( 'Install', 'themify' ),
[586] Fix | Delete
'activate'=>__( 'Activate', 'themify' ),
[587] Fix | Delete
'buy'=>__( 'Buy', 'themify' ),
[588] Fix | Delete
'note'=>__('WARNING: Importing the demo content will override your Themify settings, menu and widget settings. It will also add the content (posts, pages, featured images, widgets, menus, etc.) to your site as per our demo setup. It is recommend to do on a fresh/development site.','themify'),
[589] Fix | Delete
'plugins'=>array(
[590] Fix | Delete
'activate_done'=>__('%plugin% successfully activated','themify'),
[591] Fix | Delete
'activate_fail'=>__('Failed to activate %plugin%: %error%','themify'),
[592] Fix | Delete
'install_fail'=>__('Failed to install %plugin%: %error%','themify'),
[593] Fix | Delete
'install_done'=>__('%plugin% successfully installed','themify'),
[594] Fix | Delete
'install'=>__('Installing %plugin%','themify'),
[595] Fix | Delete
'activate'=>__('Activating %plugin%','themify'),
[596] Fix | Delete
)
[597] Fix | Delete
);
[598] Fix | Delete
$result['has_demo']=Themify_Import_Helper::has_demo_content();
[599] Fix | Delete
wp_send_json_success($result);
[600] Fix | Delete
}
[601] Fix | Delete
[602] Fix | Delete
/**
[603] Fix | Delete
* Install or Activate plugin for skin demo import and themify updater
[604] Fix | Delete
*/
[605] Fix | Delete
function themify_activate_plugin() {
[606] Fix | Delete
check_ajax_referer( 'tf_nonce', 'nonce' );
[607] Fix | Delete
$err='';
[608] Fix | Delete
if(!empty($_POST['plugin']) && current_user_can( 'edit_theme_options' ) ){
[609] Fix | Delete
$plugin=sanitize_key($_POST['plugin']);
[610] Fix | Delete
$plugin_info = themify_get_known_plugin_info($plugin);
[611] Fix | Delete
if($plugin_info!==false){
[612] Fix | Delete
$allPlugins= get_plugins();
[613] Fix | Delete
if(isset($allPlugins[$plugin_info['path']])){
[614] Fix | Delete
unset($allPlugins);
[615] Fix | Delete
if(!is_plugin_active( $plugin_info['path'] )){
[616] Fix | Delete
if(current_user_can( 'activate_plugin', $plugin )){
[617] Fix | Delete
$result =activate_plugin($plugin_info['path'],false,false);
[618] Fix | Delete
if(is_wp_error($result)){
[619] Fix | Delete
$err=$result->get_error_message();
[620] Fix | Delete
}
[621] Fix | Delete
}
[622] Fix | Delete
else{
[623] Fix | Delete
$err=__( 'You are not allowed to activate this plugin.','themify' );
[624] Fix | Delete
}
[625] Fix | Delete
}
[626] Fix | Delete
}
[627] Fix | Delete
elseif(current_user_can( 'install_plugins' )){
[628] Fix | Delete
$isFree=!empty($plugin_info['wp_hosted']);
[629] Fix | Delete
if($isFree===false){
[630] Fix | Delete
if($plugin==='themify-updater'){
[631] Fix | Delete
if(!empty( $_FILES['data'] ) && is_file($_FILES['data']['tmp_name'] )){
[632] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
[633] Fix | Delete
$updgrader=new Plugin_Upgrader();
[634] Fix | Delete
$result=$updgrader->install($_FILES['data']['tmp_name'],array('overwrite_package'=>true));
[635] Fix | Delete
if($result===true){
[636] Fix | Delete
$result =activate_plugin($plugin_info['path'],false,false);
[637] Fix | Delete
if(is_wp_error($result)){
[638] Fix | Delete
$err=$result->get_error_message();
[639] Fix | Delete
}
[640] Fix | Delete
}
[641] Fix | Delete
else{
[642] Fix | Delete
$err= is_wp_error($result)?$result->get_error_message():__('Themify Updater installation failed','themify');
[643] Fix | Delete
}
[644] Fix | Delete
}
[645] Fix | Delete
else{
[646] Fix | Delete
$err=array('install_updater'=>1);
[647] Fix | Delete
}
[648] Fix | Delete
}
[649] Fix | Delete
else{
[650] Fix | Delete
if(!class_exists('Themify_Updater',false)){
[651] Fix | Delete
$updater=themify_get_known_plugin_info('themify-updater');
[652] Fix | Delete
if(isset($allPlugins[$updater['path']]) && !is_plugin_active( $updater['path'] )){
[653] Fix | Delete
$result =activate_plugin($updater['path'],false,false);
[654] Fix | Delete
if(is_wp_error($result)){
[655] Fix | Delete
$err=$result->get_error_message();
[656] Fix | Delete
}
[657] Fix | Delete
elseif(!class_exists('Themify_Updater',false) && function_exists('themify_updater_init')){//plugins_loaded event already fired
[658] Fix | Delete
themify_updater_init();
[659] Fix | Delete
}
[660] Fix | Delete
}
[661] Fix | Delete
unset($updater);
[662] Fix | Delete
}
[663] Fix | Delete
unset($allPlugins);
[664] Fix | Delete
if($err===''){
[665] Fix | Delete
$themify_updater = class_exists('Themify_Updater',false)?Themify_Updater::get_instance():null;
[666] Fix | Delete
if($themify_updater && method_exists($themify_updater, 'get_versions')){
[667] Fix | Delete
$versions = $themify_updater->get_versions();
[668] Fix | Delete
$isFree=!empty($versions)?$versions->has_attribute($plugin, 'wp_hosted'):false;
[669] Fix | Delete
unset($versions);
[670] Fix | Delete
}
[671] Fix | Delete
else{
[672] Fix | Delete
$themify_updater=null;
[673] Fix | Delete
}
[674] Fix | Delete
}
[675] Fix | Delete
}
[676] Fix | Delete
}
[677] Fix | Delete
if($err==='' && $plugin!=='themify-updater'){
[678] Fix | Delete
if($isFree===true){
[679] Fix | Delete
$_POST['slug']=$plugin;
[680] Fix | Delete
$_REQUEST['_ajax_nonce']=wp_create_nonce( 'updates' );
[681] Fix | Delete
wp_ajax_install_plugin();
[682] Fix | Delete
}
[683] Fix | Delete
elseif(empty($themify_updater)){
[684] Fix | Delete
$err=array('install_updater'=>1);
[685] Fix | Delete
}
[686] Fix | Delete
else{
[687] Fix | Delete
if($themify_updater->has_error()){
[688] Fix | Delete
$err=array('check_license'=>1,'errorMessage'=>sprintf(__('A valid membership is required to install %s','themify'),$plugin_info['name']));
[689] Fix | Delete
}
[690] Fix | Delete
elseif(!$themify_updater->has_access( $plugin )){
[691] Fix | Delete
$err=array('buy'=>1,'errorMessage'=>sprintf(__('Your membership/license does not include %s','themify'),$plugin_info['name']),'url'=>$plugin_info['page']);
[692] Fix | Delete
}
[693] Fix | Delete
else{
[694] Fix | Delete
$nonce=wp_create_nonce( 'install-plugin_'. str_replace('-plugin', '', $plugin) );
[695] Fix | Delete
$installUrl= add_query_arg(array('action'=>'install-plugin','plugin'=>$plugin,'_wpnonce'=>$nonce),self_admin_url( 'update.php' ));
[696] Fix | Delete
wp_send_json_success(array('install_plugin_url'=>$installUrl));
[697] Fix | Delete
}
[698] Fix | Delete
[699] Fix | Delete
}
[700] Fix | Delete
unset($themify_updater,$plugin_info);
[701] Fix | Delete
}
[702] Fix | Delete
}
[703] Fix | Delete
else{
[704] Fix | Delete
$err=__( 'You are not allowed to install plugins on this site.','themify' );
[705] Fix | Delete
}
[706] Fix | Delete
if($err===''){
[707] Fix | Delete
wp_send_json_success();
[708] Fix | Delete
}
[709] Fix | Delete
}
[710] Fix | Delete
else{
[711] Fix | Delete
$err=__('Unknown Plugin.','themify');
[712] Fix | Delete
}
[713] Fix | Delete
}
[714] Fix | Delete
wp_send_json_error($err);
[715] Fix | Delete
}
[716] Fix | Delete
[717] Fix | Delete
/**
[718] Fix | Delete
* Handle the display of the Themify News admin dashboard widget
[719] Fix | Delete
*
[720] Fix | Delete
* Hooked to wp_ajax_themify_news_widget
[721] Fix | Delete
*/
[722] Fix | Delete
function themify_news_widget() {
[723] Fix | Delete
ob_start();
[724] Fix | Delete
wp_widget_rss_output( 'https://themify.me/blog/feed', array(
[725] Fix | Delete
'title' => esc_html__( 'Themify News', 'themify' ),
[726] Fix | Delete
'items' => 4,
[727] Fix | Delete
'show_summary' => 1,
[728] Fix | Delete
'show_author' => 0,
[729] Fix | Delete
'show_date' => 1
[730] Fix | Delete
) );
[731] Fix | Delete
$cache_key = 'themify_news_dashboard_widget';
[732] Fix | Delete
Themify_Storage::set( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // Default lifetime in cache of 12 hours (same as the feeds)
[733] Fix | Delete
wp_die();
[734] Fix | Delete
}
[735] Fix | Delete
[736] Fix | Delete
[737] Fix | Delete
/**
[738] Fix | Delete
* Handle the upload json file
[739] Fix | Delete
*/
[740] Fix | Delete
function themify_upload_json(){
[741] Fix | Delete
check_ajax_referer( 'tf_nonce', 'nonce' );
[742] Fix | Delete
if (!empty($_POST['file'])) {
[743] Fix | Delete
if (!current_user_can('upload_files')) {
[744] Fix | Delete
$error = __('You aren`t allowed to upload file', 'themify');
[745] Fix | Delete
} else {
[746] Fix | Delete
if ( isset( $_POST['data'] ) ) {
[747] Fix | Delete
$data = stripslashes_deep( $_POST['data'] );
[748] Fix | Delete
}
[749] Fix | Delete
elseif ( isset( $_FILES['data'] ) ) {
[750] Fix | Delete
$data = file_get_contents( $_FILES['data']['tmp_name'] );
[751] Fix | Delete
}
[752] Fix | Delete
if(!empty($data)){
[753] Fix | Delete
global $wpdb;
[754] Fix | Delete
$slug = sanitize_file_name(pathinfo( $_POST['file'],PATHINFO_FILENAME));
[755] Fix | Delete
$filename= $slug.'.json';
[756] Fix | Delete
$sql= sprintf('post_name="%1$s" OR post_name="%1$s-1" OR post_name="%1$s-2" OR post_name="%1$s-3"',esc_sql($slug));
[757] Fix | Delete
$query = $wpdb->get_row("SELECT ID FROM {$wpdb->prefix}posts WHERE ({$sql}) AND post_type='attachment' LIMIT 1" );
[758] Fix | Delete
$attach_id=!empty($query) ? $query->ID : null;
[759] Fix | Delete
if($attach_id!==null) {
[760] Fix | Delete
$duplicate = get_attached_file($attach_id);
[761] Fix | Delete
if(!$duplicate ||!is_file($duplicate) || sha1_file($duplicate)!==sha1($data)){
[762] Fix | Delete
if($duplicate && !is_file($duplicate)){
[763] Fix | Delete
wp_delete_attachment($attach_id);
[764] Fix | Delete
}
[765] Fix | Delete
$attach_id=null;
[766] Fix | Delete
}
[767] Fix | Delete
unset($duplicate);
[768] Fix | Delete
}
[769] Fix | Delete
unset($query,$sql);
[770] Fix | Delete
if(empty($attach_id)){
[771] Fix | Delete
$tmp = trailingslashit(sys_get_temp_dir()).$filename;
[772] Fix | Delete
if(file_put_contents($tmp,$data)){
[773] Fix | Delete
$file = array(
[774] Fix | Delete
'size' => filesize($tmp),
[775] Fix | Delete
'name'=> $filename,
[776] Fix | Delete
'error'=>0,
[777] Fix | Delete
'tmp_name' => $tmp
[778] Fix | Delete
);
[779] Fix | Delete
$title=!empty($_POST['title'])?sanitize_textarea_field($_POST['title']):'';
[780] Fix | Delete
$attach_id=media_handle_sideload( $file, 0,$title,array(
[781] Fix | Delete
'post_mime_type'=>'application/json',
[782] Fix | Delete
'post_name'=>$slug
[783] Fix | Delete
) );
[784] Fix | Delete
if(is_wp_error($attach_id)){
[785] Fix | Delete
$error=$attach_id->get_error_message();
[786] Fix | Delete
$attach_id=null;
[787] Fix | Delete
if(is_file($tmp)){
[788] Fix | Delete
unlink($tmp);
[789] Fix | Delete
}
[790] Fix | Delete
}
[791] Fix | Delete
unset($tmp,$file);
[792] Fix | Delete
}else{
[793] Fix | Delete
$error = __('Can`t write tmp file', 'themify');
[794] Fix | Delete
}
[795] Fix | Delete
}
[796] Fix | Delete
if(!empty($attach_id)){
[797] Fix | Delete
wp_send_json_success(wp_get_attachment_url($attach_id));
[798] Fix | Delete
}
[799] Fix | Delete
}else{
[800] Fix | Delete
$error = __('Upload data is corrupted', 'themify');
[801] Fix | Delete
}
[802] Fix | Delete
}
[803] Fix | Delete
wp_send_json_error($error);
[804] Fix | Delete
}
[805] Fix | Delete
}
[806] Fix | Delete
[807] Fix | Delete
function themify_update_license() {
[808] Fix | Delete
check_ajax_referer( 'tf_nonce', 'nonce' );
[809] Fix | Delete
if(current_user_can( 'manage_options' )){
[810] Fix | Delete
$themify_updater = Themify_Updater::get_instance();
[811] Fix | Delete
$result = $themify_updater->menu_p(true);
[812] Fix | Delete
if(true === $result){
[813] Fix | Delete
$theme = wp_get_theme();
[814] Fix | Delete
$theme = is_child_theme() ? $theme->parent() : $theme;
[815] Fix | Delete
ob_start();
[816] Fix | Delete
$themify_updater->themify_reinstall_theme( $theme->stylesheet );
[817] Fix | Delete
$result = array('html'=>ob_get_clean());
[818] Fix | Delete
wp_send_json_success($result);
[819] Fix | Delete
}
[820] Fix | Delete
else{
[821] Fix | Delete
$msg = $result===false?__('Invalid license key. Please enter your Themify username and a valid license key.','themify'):
[822] Fix | Delete
__('You need the latest Themify Updater plugin for this feature. Please update your Themify Updater plugin.','themify');
[823] Fix | Delete
[824] Fix | Delete
wp_send_json_error($msg);
[825] Fix | Delete
}
[826] Fix | Delete
}
[827] Fix | Delete
}
[828] Fix | Delete
[829] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function