Changeset 2252206
- Timestamp:
- 02/29/2020 12:46:42 AM (6 years ago)
- Location:
- embed-githubin/trunk
- Files:
-
- 2 edited
-
githubin.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
embed-githubin/trunk/githubin.php
r2153808 r2252206 160 160 break; 161 161 case 'repos': 162 $content_githubin=preg_replace('/<!DOCTYPE[\s\S]*?<div class=\"list repo-list/imu','<div class="list repo-list',$content_githubin); 162 //$content_githubin=preg_replace('/<!DOCTYPE[\s\S]*?<div class=\"list repo-list/imu','<div class="list repo-list',$content_githubin); 163 $content_githubin=preg_replace('/<!DOCTYPE[\s\S]*?<div id=\"user-repositories-list/imu','<div id="user-repositories-list',$content_githubin); 164 $content_githubin=preg_replace('/<!DOCTYPE[\s\S]*?<div class=\"org-repos repo-list/imu','<div class="org-repos repo-list',$content_githubin); 163 165 break; 164 166 } … … 167 169 168 170 if($type=='readme') 169 $content_githubin=preg_replace('/<\/article>[\s\S]*<\/html>/imu','',$content_githubin); 170 else 171 { 172 $content_githubin=preg_replace('/<div class=\"footer [\s\S]*<\/html>/imu','',$content_githubin); //ahora han cambiado en según que páginas footer por div class="footer 173 //$content_githubin=preg_replace('/<\/table>[\s\S]*<\/html>/imu','',$content_githubin);//para ficheros quitamos desde que finaliza la tabla de contenido </table> hasta el final 174 $content_githubin=preg_replace('/<footer class[\s\S]*<\/html>/imu','',$content_githubin); 175 } 171 $content_githubin=preg_replace('/<\/article>[\s\S]*<\/html>/imu','</article>',$content_githubin); 172 else 173 { 174 if($type=='repos') 175 { 176 //$content_githubin=preg_replace('/<div class=(?!.[\s\S]*<div class=)[\s\S]*js-profile-tab-count-container[\s\S]*<\/html>/imu','',$content_githubin); //en los repositorios de organizaciones también hay más contenido que sobra ; forzamos a que coja el último match con -> MATCH(?!.[\s\S]*MATCH) donde match es el último atributo a buscar 177 $content_githubin=preg_replace('/<\/ul>[\s\S]*<\/html>/imu','</ul></div>',$content_githubin); 178 } 179 else 180 { 181 $content_githubin=preg_replace('/<div class=\"footer [\s\S]*<\/html>/imu','',$content_githubin); //ahora han cambiado en según que páginas footer por div class="footer 182 //$content_githubin=preg_replace('/<\/table>[\s\S]*<\/html>/imu','',$content_githubin);//para ficheros quitamos desde que finaliza la tabla de contenido </table> hasta el final 183 $content_githubin=preg_replace('/<footer class[\s\S]*<\/html>/imu','',$content_githubin); 184 } 185 } 186 187 if($type=='repos') //limpiamos el nuevo contenido que han añadido 188 { 189 //limpiamos bloques de licencias 190 $content_githubin=preg_replace('/<div class="f6 text-gray mt-2">[\s\S]*?<\/div>/imu','',$content_githubin); 191 $content_githubin=preg_replace('/<div class="text-gray f6 mt-2">[\s\S]*?<\/div>/imu','',$content_githubin); 192 193 } 194 176 195 if($type=='file') 177 196 { //css de enlightment de github: … … 238 257 239 258 //convertimos los h1 y h2 y h3 en <b> para controlar el color en temas oscuros y reducir el tamaño: 240 $content_githubin=preg_replace('/<h[1-3]>/imu','<b>',$content_githubin); 241 $content_githubin=preg_replace('/<\/h[1-3]>/imu','</b>',$content_githubin); 259 if($type=='repos') //si es repositorio le damos estilo (ya que nos lo han cambiado todo) 260 { 261 $content_githubin=preg_replace('/<h[1-3].*?>/imu',' 262 <p style="padding-top:4px;margin-bottom:0;"> 263 <svg class="octicon octicon-repo" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"></path></svg> 264 ',$content_githubin); 265 } 266 else 267 $content_githubin=preg_replace('/<h[1-3].*?>/imu','<p>',$content_githubin); 268 $content_githubin=preg_replace('/<\/h[1-3]?>/imu','</p>',$content_githubin); 242 269 243 270 //reemplazamos links del repositorio con la ruta absoluta: -
embed-githubin/trunk/readme.txt
r2101540 r2252206 3 3 Tags: github, github embed, embed 4 4 Requires at least: 2.7.0 5 Tested up to: 5. 2.15 Tested up to: 5.3.2 6 6 Requires PHP: 5.2 7 7 License: GPLv3
Note: See TracChangeset
for help on using the changeset viewer.