Skip to content

Commit

Permalink
plugin is ok
Browse files Browse the repository at this point in the history
  • Loading branch information
baldomerocho committed Jan 10, 2022
0 parents commit 4aec54f
Show file tree
Hide file tree
Showing 35 changed files with 2,006 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/gist-theme-wp.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

339 changes: 339 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions gist-theme-wp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

/*
Plugin Name: Gist Theme Wp
Plugin URI: https://datogedon.com/wordpress/plugins/gist-theme-wp/
Description: Change the theme of your embedded gists.
Version: 1.0.0
Author: Baldomero Cho
Author URI: https://datogedon.com
License: GPLv2 or later
*/

$option_name = "current_gist_theme_wp";
$defaultTheme = "obsidian";

if(get_option($option_name)){
$currentTheme = get_option($option_name);
}
else {
add_option($option_name, $defaultTheme);
}

add_action('admin_menu', 'gist_theme_wp_setup_menu');

function gist_theme_wp_setup_menu(){
add_menu_page( 'Gist Theme Config', 'Gist Theme', 'manage_options', 'gist-theme-wp', 'gist_theme_wp' );
}


wp_register_style('gistthemecode', plugins_url('stylesheets/'.$currentTheme.'.css',__FILE__ ));
wp_register_style('defaultvalues', plugins_url('stylesheets/defaultvalues.css',__FILE__ ));

wp_enqueue_style( 'gistthemecode' );
wp_enqueue_style( 'defaultvalues' );

function gist_theme_wp(){
echo "<h1>Gist Theme Config</h1>";
include "make.php";
}
75 changes: 75 additions & 0 deletions make.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html>

<head>

<!-- IMPORT SCRIPTS JS [VUEJS, SWEET ALERT 2] -->
<script src="https://unpkg.com/vue@2.5.2"></script>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
</head>

<body>

<?php
// VALIDATE IF CURRENT GIST THEME WP IS CHANGED ON POST
$option_name = "current_gist_theme_wp";
$new_value = $_POST["newGistThemeWPSelected"];
$get_option = get_option($option_name);
if ($_POST["theme"] != "" && $_POST["theme"] != $get_option) {
if ($get_option != $new_value) {
update_option($option_name, $new_value);
echo '<script type="text/javascript">
Swal.fire(
`' . strtoupper($_POST["theme"]) . ' selected`,
`Gist Theme Updated`,
`success`
);
</script>';
} else {
$deprecated = ' ';
$autoload = 'no';
add_option($option_name, $new_value, $deprecated, $autoload);
}
$get_option = get_option($option_name);


}


// CREATE FORM FOR UPDATE OR CHANGE GIST THEME WP


?>
<div id="app">
<h2>Current theme: {{selection.toUpperCase()}}</h2>
<img v-bind:src="ruta+selection+'.png'" alt="" style="margin:20px 0">
<form id="updateGistThemeWP" name="updateGistThemeWP" method="POST">
<select id="newGistThemeWPSelected" size="1" v-model="selection" name="newGistThemeWPSelected">
<option v-for="item in items" :value="item">{{item.toUpperCase()}}</option>
</select>
<input type="submit" value="Save" style=""/>

</form>
</div>


<script>
(async () => {
const productsResponse = await fetch(<?php echo '"' . plugins_url('gist-theme-wp/options.json', dirname(__FILE__)) . '"'?>);
const products = await productsResponse.json();

new Vue({
el: '#app',
data() {
return {
items: products,
selection: <?php echo '"' . $get_option . '"'?>,
ruta: <?php echo '"' . plugins_url('gist-theme-wp/themes-gist/', dirname(__FILE__)) . '"'?>
}
}
})
})();
</script>
</body>

</html>
14 changes: 14 additions & 0 deletions options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
"chaos",
"cobalt",
"idle-fingers",
"monokai",
"obsidian",
"one-dark",
"pastel-on-dark",
"solarized-dark",
"solarized-light",
"terminal",
"tomorrow-night",
"twilight"
]
32 changes: 32 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
=== Gist Theme WP ===
Contributors: baldomerocho
Tags: github gist, gist theme github, gist code, code with gist theme, change theme gist
Donate link: https://www.paypal.com/donate?hosted_button_id=FY8NBZJSJ6RXW
Requires at least: 5.0
Tested up to: 5.0
Requires PHP: 7.4
Stable tag: stable
License: GPLv2 or later

Change the theme of your embedded gists.

== Description ==
Change the theme of your embedded gists.
When you insert your gist from github.com it is displayed with the default theme or git layout.
But we can change the layout of the code to display as in our code editors.

== Installation ==
Upload the Gist Theme WP plugin to your blog, activate it and you\'re done.

== Frequently Asked Questions ==
is official Github?
No, not is official plugin.

== Screenshots ==
1. Simple Panel Admin

== Changelog ==
1.0.0

== Upgrade Notice ==
All ready
Binary file added screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions stylesheets/chaos.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
body .gist .highlight {
background: #161616;
}
body .gist .blob-num,
body .gist .blob-code-inner,
body .gist .pl-st {
color: #e6e1dc;
}
body .gist .pl-c,
body .gist .pl-c span {
color: #555;
font-style: italic;
}
body .gist .pl-mb {
color: #1edafb;
font-weight: 700;
}
body .gist .pl-mh .pl-en {
color: #fdc251;
font-weight: 700;
}
body .gist .pl-mi {
color: #00698f;
font-style: italic;
}
body .gist .pl-mq {
color: #555;
}
body .gist .pl-sc {
color: #999;
}
body .gist .pl-c1,
body .gist .pl-mh,
body .gist .pl-sr .pl-cce {
color: #fdc251;
}
body .gist .pl-e,
body .gist .pl-en,
body .gist .pl-ent,
body .gist .pl-s,
body .gist .pl-v,
body .gist .pl-vpf {
color: #974;
}
body .gist .pl-k,
body .gist .pl-mdh,
body .gist .pl-mdr,
body .gist .pl-ml,
body .gist .pl-mm,
body .gist .pl-mo,
body .gist .pl-mp,
body .gist .pl-mr,
body .gist .pl-ms,
body .gist .pl-s1 .pl-v,
body .gist .pl-s3 {
color: #00698f;
}
body .gist .pl-pds,
body .gist .pl-s1,
body .gist .pl-s1 .pl-pse .pl-s2 {
color: #58c554;
}
body .gist .pl-s1 .pl-s2,
body .gist .pl-sv {
color: #1edafb;
}
body .gist .pl-smi,
body .gist .pl-smp,
body .gist .pl-stj,
body .gist .pl-vo {
color: #be53e6;
}
body .gist .pl-sr,
body .gist .pl-sr .pl-sra,
body .gist .pl-sr .pl-sre,
body .gist .pl-src {
color: #ff308f;
}
body .gist .pl-mi1,
body .gist .pl-mdht {
color: #fff;
background: rgba(0, 64, 0, .5);
}
body .gist .pl-md,
body .gist .pl-mdhf,
body .gist .pl-id,
body .gist .pl-ii {
color: #fff;
background: #900;
}
96 changes: 96 additions & 0 deletions stylesheets/cobalt.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
body .gist .highlight {
background: #002240;
}
body .gist .blob-num,
body .gist .blob-code-inner,
body .gist .pl-en {
color: #fff;
}
body .gist .pl-mb,
body .gist .pl-mh .pl-en {
font-weight: 700;
}
body .gist .pl-c,
body .gist .pl-c span,
body .gist .pl-mi {
font-style: italic;
}
body .gist .pl-ent,
body .gist .pl-v {
color: #fd0;
}
body .gist .pl-mh,
body .gist .pl-mh .pl-en,
body .gist .pl-sr .pl-cce {
color: #eb939a;
}
body .gist .pl-pds,
body .gist .pl-s,
body .gist .pl-s1,
body .gist .pl-s1 .pl-pse .pl-s2,
body .gist .pl-s1 .pl-v {
color: #3ad900;
}
body .gist .pl-s1 .pl-s2,
body .gist .pl-smi,
body .gist .pl-smp,
body .gist .pl-stj,
body .gist .pl-vo,
body .gist .pl-vpf {
color: #ccc;
}
body .gist .pl-s3,
body .gist .pl-sc {
color: #ffb054;
}
body .gist .pl-sr,
body .gist .pl-sr .pl-sra,
body .gist .pl-sr .pl-sre,
body .gist .pl-src {
color: #80ffc2;
}
body .gist .pl-mdht,
body .gist .pl-mi1 {
color: #f8f8f8;
background: rgba(0, 64, 0, .5);
}
body .gist .pl-id,
body .gist .pl-ii,
body .gist .pl-md,
body .gist .pl-mdhf {
color: #f8f8f8;
background: #800f00;
}
body .gist .highlight-source-js .pl-st {
color: #ffee80;
}
body .gist .highlight-source-css .pl-s3 {
color: #80ffbb;
}
body .gist .highlight-text-html-basic .pl-ent {
color: #9effff;
}
body .gist .pl-c,
body .gist .pl-c span,
body .gist .pl-mq {
color: #08f;
}
body .gist .pl-c1,
body .gist .pl-sv,
body .gist .pl-mb {
color: #ff628c;
}
body .gist .pl-e,
body .gist .pl-k,
body .gist .pl-mdh,
body .gist .pl-mdr,
body .gist .pl-ml,
body .gist .pl-mm,
body .gist .pl-mo,
body .gist .pl-mp,
body .gist .pl-mr,
body .gist .pl-ms,
body .gist .pl-st,
body .gist .pl-mi {
color: #ff9d00;
}
Loading

0 comments on commit 4aec54f

Please sign in to comment.