File: /home/slyfwmm/laretediclo/wp-content/themes/kicker-child/.lh/functions.php.json
{
"sourceFile": "functions.php",
"activeCommit": 0,
"commits": [
{
"activePatchIndex": 1,
"patches": [
{
"date": 1646923154123,
"content": "Index: \n===================================================================\n--- \n+++ \n"
},
{
"date": 1646929199626,
"content": "Index: \n===================================================================\n--- \n+++ \n@@ -127,8 +127,9 @@\n );\n $img = get_posts( $args );\n if($img) {\n $img_url = $img[0]->guid;\n+ $img_alt = get_field('img_1_dida');\n $img = '<img src=\"'.$img_url.'\" alt=\"'.$img_alt.'\" />';\n $img_tipo_lic = get_field('img_1_tipo_lic');\n if(!($img_tipo_lic === 'Ufficio stampa' || $img_tipo_lic === 'Royalty free' || $img_tipo_lic === 'Immagini acquistate')) {\n if($img_tipo_lic === 'Inedita di proprietà') {\n@@ -158,8 +159,9 @@\n );\n $img = get_posts( $args );\n if($img) {\n $img_url = $img[0]->guid;\n+ $img_alt = get_field('img_2_dida');\n $img = '<img src=\"'.$img_url.'\" alt=\"'.$img_alt.'\" />';\n $img_tipo_lic = get_field('img_2_tipo_lic');\n if(!($img_tipo_lic === 'Ufficio stampa' || $img_tipo_lic === 'Royalty free' || $img_tipo_lic === 'Immagini acquistate')) {\n if($img_tipo_lic === 'Inedita di proprietà') {\n@@ -189,8 +191,9 @@\n );\n $img = get_posts( $args );\n if($img) {\n $img_url = $img[0]->guid;\n+ $img_alt = get_field('img_3_dida');\n $img = '<img src=\"'.$img_url.'\" alt=\"'.$img_alt.'\" />';\n $img_tipo_lic = get_field('img_3_tipo_lic');\n if(!($img_tipo_lic === 'Ufficio stampa' || $img_tipo_lic === 'Royalty free' || $img_tipo_lic === 'Immagini acquistate')) {\n if($img_tipo_lic === 'Inedita di proprietà') {\n"
}
],
"date": 1646923154123,
"name": "Commit-0",
"content": "<?php\n/**\n * Child-Theme functions and definitions\n */\n\nfunction kicker_child_scripts() {\n wp_enqueue_style( 'kicker-style', get_template_directory_uri(). '/style.css' );\n}\nadd_action( 'wp_enqueue_scripts', 'kicker_child_scripts' );\n\n\n\n\nfunction LRC_insert_img() {\n\n $content = get_the_content();\t\n\n if (str_contains($content, '[img1]')) {\n if(get_field('img_1')) {\n $img_alt = get_field('img_1_dida');\n $img_name = get_field('img_1');\n $img_name = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '', $img_name); \n $args = array(\n 'post_type' => 'attachment',\n 'name' => $img_name,\n 'posts_per_page' => 1,\n 'post_status' => 'inherit',\n );\n $img = get_posts( $args );\n if($img) {\n $img_url = $img[0]->guid;\n $img = '<img class=\"LRC_img_text\" src=\"'.$img_url.'\" alt=\"'.$img_alt.'\" />';\n $content = str_replace('[img1]',$img,$content);\n } else {\n $content = str_replace('[img1]','',$content);\n }\n } else {\n $content = str_replace('[img1]','',$content);\n }\n }\n if (str_contains($content, '[img2]')) {\n if(get_field('img_2')) {\n $img_alt = get_field('img_2_dida');\n $img_name = get_field('img_2');\n $img_name = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '', $img_name); \n $args = array(\n 'post_type' => 'attachment',\n 'name' => $img_name,\n 'posts_per_page' => 1,\n 'post_status' => 'inherit',\n );\n $img = get_posts( $args );\n if($img) {\n $img_url = $img[0]->guid;\n $img = '<img class=\"LRC_img_text\" src=\"'.$img_url.'\" alt=\"'.$img_alt.'\" />';\n $content = str_replace('[img2]',$img,$content);\n } else {\n $content = str_replace('[img2]','',$content);\n }\n } else {\n $content = str_replace('[img2]','',$content);\n }\n }\n if (str_contains($content, '[img3]')) {\n if(get_field('img_3')) {\n $img_alt = get_field('img_3_dida');\n $img_name = get_field('img_3');\n $img_name = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '', $img_name); \n $args = array(\n 'post_type' => 'attachment',\n 'name' => $img_name,\n 'posts_per_page' => 1,\n 'post_status' => 'inherit',\n );\n $img = get_posts( $args );\n if($img) {\n $img_url = $img[0]->guid;\n $img = '<img class=\"LRC_img_text\" src=\"'.$img_url.'\" alt=\"'.$img_alt.'\" />';\n $content = str_replace('[img3]',$img,$content);\n } else {\n $content = str_replace('[img3]','',$content);\n }\n } else {\n $content = str_replace('[img3]','',$content);\n }\n }\n \n return $content;\n\n}\n\nfunction LRC_insert_license_img() {\n\n $lic_img_pric = NULL;\n $lic_img1 = NULL;\n $lic_img2 = NULL;\n $lic_img3 = NULL;\n\n if (has_post_thumbnail() ) {\n $img = get_the_post_thumbnail();\n $img_princ_tipo_lic = get_field('img_princ_tipo_lic');\n if(!($img_princ_tipo_lic === 'Ufficio stampa' || $img_princ_tipo_lic === 'Royalty free' || $img_princ_tipo_lic === 'Immagini acquistate')) {\n if($img_princ_tipo_lic === 'Inedita di proprietà') {\n $lic_img_pric = '<div>'.$img.'<p>Autore della foto <strong>Ad culture: portale di informazione su architettura e design</strong> - sei libero di utilizzare la presente foto secondo la licenza <a href=\"https://creativecommons.org/licenses/by-nc/3.0/it/\" target=\"_blank\">CC by-nc 3.0</a></p></div>';\n } else {\n if( get_field('img_princ_fonte') || get_field('img_princ_titolo') || get_field('img_princ_autore') ) {\n $link = get_field('img_princ_fonte');\n if(!($link === '')) { $link = 'href=\"'.$link.'\" target=\"_blank\"'; } \n $autor = get_field('img_princ_autore');\n if(!($autor === '')) { $autor = ' di <strong>'.$autor.'</strong>'; }\n $link_name = empty(get_field('img_princ_titolo')) ? 'questa foto' : get_field('img_princ_titolo');\n if(get_field('img_princ_link_lic')) { $license = ' (vedi <a href=\"'.get_field('img_princ_link_lic').'\" target=\"_blank\">licensa</a>)'; } else { $license = NULL; }\n $lic_img_pric = '<div>'.$img.'<p>Foto derivata da <a '.$link.'>'.$link_name.'</a>'.$autor.$license.'</p></div>';\n }\n }\n }\n }\n\n if(get_field('img_1')) {\n $img_name = get_field('img_1');\n $img_name = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '', $img_name); \n $args = array(\n 'post_type' => 'attachment',\n 'name' => $img_name,\n 'posts_per_page' => 1,\n 'post_status' => 'inherit',\n );\n $img = get_posts( $args );\n if($img) {\n $img_url = $img[0]->guid;\n $img = '<img src=\"'.$img_url.'\" alt=\"'.$img_alt.'\" />';\n $img_tipo_lic = get_field('img_1_tipo_lic');\n if(!($img_tipo_lic === 'Ufficio stampa' || $img_tipo_lic === 'Royalty free' || $img_tipo_lic === 'Immagini acquistate')) {\n if($img_tipo_lic === 'Inedita di proprietà') {\n $lic_img1 = '<div>'.$img.'<p>Autore della foto <strong>Ad culture: portale di informazione su architettura e design</strong> - sei libero di utilizzare la presente foto secondo la licenza <a href=\"https://creativecommons.org/licenses/by-nc/3.0/it/\" target=\"_blank\">CC by-nc 3.0</a></p></div>';\n } else {\n if( get_field('img_1_fonte') || get_field('img_1_titolo') || get_field('img_1_autore') ) {\n $link = get_field('img_1_fonte');\n if(!($link === '')) { $link = 'href=\"'.$link.'\" target=\"_blank\"'; } \n $autor = get_field('img_1_autore');\n if(!($autor === '')) { $autor = ' di <strong>'.$autor.'</strong>'; }\n $link_name = empty(get_field('img_1_titolo')) ? 'questa foto' : get_field('img_1_titolo');\n $lic_img1 = '<div>'.$img.'<p>Foto derivata da <a '.$link.'>'.$link_name.'</a>'.$autor.'</p></div>';\n }\n }\n }\n }\n }\n\n if(get_field('img_2')) {\n $img_name = get_field('img_2');\n $img_name = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '', $img_name); \n $args = array(\n 'post_type' => 'attachment',\n 'name' => $img_name,\n 'posts_per_page' => 1,\n 'post_status' => 'inherit',\n );\n $img = get_posts( $args );\n if($img) {\n $img_url = $img[0]->guid;\n $img = '<img src=\"'.$img_url.'\" alt=\"'.$img_alt.'\" />';\n $img_tipo_lic = get_field('img_2_tipo_lic');\n if(!($img_tipo_lic === 'Ufficio stampa' || $img_tipo_lic === 'Royalty free' || $img_tipo_lic === 'Immagini acquistate')) {\n if($img_tipo_lic === 'Inedita di proprietà') {\n $lic_img2 = '<div>'.$img.'<p>Autore della foto <strong>Ad culture: portale di informazione su architettura e design</strong> - sei libero di utilizzare la presente foto secondo la licenza <a href=\"https://creativecommons.org/licenses/by-nc/3.0/it/\" target=\"_blank\">CC by-nc 3.0</a></p></div>';\n } else {\n if( get_field('img_2_fonte') || get_field('img_2_titolo') || get_field('img_2_autore') ) {\n $link = get_field('img_2_fonte');\n if(!($link === '')) { $link = 'href=\"'.$link.'\" target=\"_blank\"'; } \n $autor = get_field('img_2_autore');\n if(!($autor === '')) { $autor = ' di <strong>'.$autor.'</strong>'; }\n $link_name = empty(get_field('img_2_titolo')) ? 'questa foto' : get_field('img_2_titolo');\n $lic_img2 = '<div>'.$img.'<p>Foto derivata da <a '.$link.'>'.$link_name.'</a>'.$autor.'</p></div>';\n }\n }\n }\n }\n }\n\n if(get_field('img_3')) {\n $img_name = get_field('img_3');\n $img_name = preg_replace('/\\\\.[^.\\\\s]{3,4}$/', '', $img_name); \n $args = array(\n 'post_type' => 'attachment',\n 'name' => $img_name,\n 'posts_per_page' => 1,\n 'post_status' => 'inherit',\n );\n $img = get_posts( $args );\n if($img) {\n $img_url = $img[0]->guid;\n $img = '<img src=\"'.$img_url.'\" alt=\"'.$img_alt.'\" />';\n $img_tipo_lic = get_field('img_3_tipo_lic');\n if(!($img_tipo_lic === 'Ufficio stampa' || $img_tipo_lic === 'Royalty free' || $img_tipo_lic === 'Immagini acquistate')) {\n if($img_tipo_lic === 'Inedita di proprietà') {\n $lic_img3 = '<div>'.$img.'<p>Autore della foto <strong>Ad culture: portale di informazione su architettura e design</strong> - sei libero di utilizzare la presente foto secondo la licenza <a href=\"https://creativecommons.org/licenses/by-nc/3.0/it/\" target=\"_blank\">CC by-nc 3.0</a></p></div>';\n } else {\n if( get_field('img_3_fonte') || get_field('img_3_titolo') || get_field('img_3_autore') ) {\n $link = get_field('img_3_fonte');\n if(!($link === '')) { $link = 'href=\"'.$link.'\" target=\"_blank\"'; } \n $autor = get_field('img_3_autore');\n if(!($autor === '')) { $autor = ' di <strong>'.$autor.'</strong>'; }\n $link_name = empty(get_field('img_3_titolo')) ? 'questa foto' : get_field('img_3_titolo');\n $lic_img3 = '<div>'.$img.'<p>Foto derivata da <a '.$link.'>'.$link_name.'</a>'.$autor.'</p></div>';\n }\n }\n }\n }\n }\n\n return $lic_img_pric.$lic_img1.$lic_img2.$lic_img3;\n}\n\n?>"
}
]
}