diff --git a/images/index.php b/admin/css/index.php
old mode 100755
new mode 100644
similarity index 100%
rename from images/index.php
rename to admin/css/index.php
diff --git a/admin/css/repository-block-editor.css b/admin/css/repository-block-editor.css
new file mode 100644
index 0000000..5063374
--- /dev/null
+++ b/admin/css/repository-block-editor.css
@@ -0,0 +1,91 @@
+.ebg-br-wrapper .ebg-br-editmode {
+ display: initial !important;
+}
+
+.ebg-br-wrapper .ebg-br-border {
+ border: 1px solid #eee !important;
+}
+
+.ebg-br-wrapper .ebg-br-background-color {
+ background-color: whitesmoke !important;
+ color: black !important;
+}
+
+.ebg-br-wrapper .ebg-br-icon,
+.ebg-br-wrapper .ebg-br-logo.fab.fa-github {
+ color: black !important;
+}
+
+.ebg-br-wrapper .ebg-br-col-main .ebg-br-title em {
+ padding-top: 0.40em !important;
+}
+
+.ebg-br-wrapper .ebg-br-img-color-auto {
+ -webkit-filter: invert(0) !important;
+ -moz-filter: invert(0) !important;
+ -o-filter: invert(0) !important;
+ -ms-filter: invert(0) !important;
+ filter: invert(0) !important;
+}
+
+
+/*
+ CSS > Template Error
+*/
+.ebg-br-wrapper .ebg-br-template-error .ebg-br-body p {
+ margin: 0px !important;
+ padding: 0px !important;
+}
+
+.ebg-br-wrapper .ebg-br-template-error .ebg-br-body .ebg-br-title {
+ padding-bottom: 0.5em !important;
+
+}
+
+
+/*
+ CSS > Template User
+*/
+.ebg-br-wrapper .ebg-br-template-user .ebg-br-box-ul ul {
+ border: 1px solid #eee !important;
+ background-color: white !important;
+}
+
+.ebg-br-wrapper .ebg-br-template-user .ebg-br-icon.ebg-br-cfg-icon-type-source-file_svg {
+ width: 17px !important;
+}
+
+/*
+ Class button status dark Theme
+*/
+.ebg-br-wrapper .ebg-br-body {
+ padding-bottom: 40px !important;
+}
+
+.ebg-br-wrapper .egb-br-dark_theme-status {
+ position: absolute;
+ display: block;
+ right: 0;
+ bottom: 0;
+ padding-right: 0.5em;
+ padding-bottom: 0.5em;
+}
+
+.ebg-br-wrapper .egb-br-dark_theme-status .egb-br-dark_theme-status-img {
+ display: inline-block;
+ margin-right: 0.5em;
+ padding-left: calc(64px + 0.5em);
+ padding-bottom: 5px;
+ background-image: url('../images/on_off.png');
+ background-repeat: no-repeat;
+ background-size: 65px auto;
+ font-size: smaller;
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-on .egb-br-dark_theme-status .egb-br-dark_theme-status-img {
+ background-position: 0px 0px !important;
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-off .egb-br-dark_theme-status .egb-br-dark_theme-status-img {
+ background-position: 0px -35px !important;
+}
diff --git a/admin/images/index.php b/admin/images/index.php
new file mode 100644
index 0000000..e71af0e
--- /dev/null
+++ b/admin/images/index.php
@@ -0,0 +1 @@
+msgdebug("PAHT:".plugin_dir_path( __FILE__ ));
error_log("DEBUG: ".$msg, 0);
@@ -34,21 +36,21 @@ public function __construct() {
public function init_wp_register() {
wp_register_script(
'ebg-repository-editor',
- $this->plugin_url('repository-block.js'),
+ $this->plugin_url('admin/js/repository-block.js'),
array( 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-editor' ),
- $this->plugin_file_ver('repository-block.js')
+ $this->plugin_file_ver('admin/js/repository-block.js')
);
wp_register_style(
'ebg-repository-editor',
- $this->plugin_url('repository-block-editor.css'),
+ $this->plugin_url('admin/css/repository-block-editor.css'),
array(),
- $this->plugin_file_ver('repository-block.css')
+ $this->plugin_file_ver('admin/css/repository-block-editor.css')
);
wp_register_style(
'ebg-repository',
- $this->plugin_url('repository-block.css'),
+ $this->plugin_url('public/css/repository-block.css'),
array(),
- $this->plugin_file_ver('repository-block.css')
+ $this->plugin_file_ver('public/css/repository-block.css')
);
register_block_type( 'embed-block-for-github/repository', array(
'editor_script' => 'ebg-repository-editor',
@@ -57,19 +59,12 @@ public function init_wp_register() {
'render_callback' => array( $this, 'ebg_embed_repository' ),
'attributes' => array(
'github_url' => array( 'type' => 'string' ),
- 'darck_mode' => array( 'type' => 'boolean' ),
+ 'darck_theme' => array( 'type' => 'boolean' ),
+ 'icon_type_source' => array( 'type' => 'string' ),
),
) );
}
- private function process_template( $template, $data ) {
- ob_start();
- if ( ! locate_template( $this->plugin_name() . '/' . $template, true ) ) {
- require 'templates/' . $template;
- }
- return ob_get_clean();
- }
-
/* Get Path install plugin */
private function plugin_path(){
return plugin_dir_path( __FILE__ );
@@ -78,14 +73,14 @@ private function plugin_path(){
/* Get Path install plugin and file name. */
private function plugin_file($file){
if (strlen(trim($file)) > 0) {
- return $this->plugin_path() . $file;
+ return $this::plugin_path().$file;
}
return "";
}
/* Get version of the file using modified date. */
private function plugin_file_ver($file) {
- return filemtime( $this->plugin_file($file) );
+ return filemtime($this::plugin_file($file));
}
/* Get folder name plugin */
@@ -93,6 +88,7 @@ private function plugin_name() {
return basename( dirname( __FILE__ ) );
}
+ /* Get Url Plugin */
private function plugin_url($file) {
if (strlen(trim($file)) > 0) {
return plugins_url( $file, __FILE__ );
@@ -100,86 +96,250 @@ private function plugin_url($file) {
return "";
}
- private function check_message($message) {
+ /* Message according to the error received from GitHub. */
+ private function check_message($message, $documentation_url) {
if ($message == "Not Found") {
- return '
' . esc_html__( 'Error: Reposity not found. Please check your URL.', 'embed-block-for-github' ) . '
';
- } else {
+ return '' . esc_html__( 'Repository not found. Please check your URL.', 'embed-block-for-github' ) . '
';
+ }
+ elseif ( strpos( $message, 'API rate limit exceeded for ' ) === 0 )
+ {
+ return '' . esc_html__( 'Sorry, API Github rate limit exceeded for IP. Please try again later.', 'embed-block-for-github' ) . '
';
+ }
+ else
+ {
return '' . esc_html( sprintf( 'Error: %s', $message ) , 'embed-block-for-github' ) . '
';
}
}
+ /* All messages shown to the user. */
+ private function message($message, $arg = array()) {
+ $msg_return = "";
+ switch($message) {
+ case "url_is_null":
+ $msg_return = '' . esc_html__( 'Use the Sidebar to add the URL of the GitHub Repository to embed.', 'embed-block-for-github' ) . '
';
+ break;
+
+ case "url_not_valid":
+ $msg_return = '' . esc_html__( 'The specified URL is not valid. Check the address using the sidebar to add the repository URL.', 'embed-block-for-github' ) . '
';
+ break;
+
+ case "url_not_github":
+ $msg_return = '' . esc_html__( 'The specified URL is not from GitHub. Check the address using the sidebar to add the correct GitHub repository URL (only https allowed).', 'embed-block-for-github' ) . '
';
+ break;
+
+ case "info_no_available":
+ $msg_return = '' . esc_html__( 'No information available. Please check your URL.', 'embed-block-for-github' ) . '
';
+ break;
+ }
+ return $msg_return;
+ }
+
+ private function transient_id($prefix = "", $postfix = "") {
+ $plugin_data = get_plugin_data( __FILE__ );
+ $plugin_version = $plugin_data['Version'];
+
+ $id = "_ebg_repository_".$plugin_version."_";
+ if (! empty($prefix)) { $id = "_".$prefix.$id; }
+ if (! empty($postfix)) { $id = $id.$postfix."_"; }
+ return $id;
+ }
+
+ /* Check if the URL is correct */
+ private function check_github_url($github_url) {
+ switch(True) {
+ case ( '' === trim( $github_url ) ):
+ return "url_is_null";
+ break;
+
+ case (! filter_var( $github_url, FILTER_VALIDATE_URL ) ):
+ return "url_not_valid";
+ break;
+
+ case ( strpos( $github_url, 'https://github.com/' ) !== 0 ):
+ return "url_not_github";
+ break;
+ }
+ return "";
+ }
+
+ /* Detect type request (user, repo, etc...) */
+ private function detect_request($github_url) {
+ $slug = str_replace( 'https://github.com/', '', $github_url );
+
+ $data_return = [];
+ switch ( count(explode("/", $slug)) )
+ {
+ case 1:
+ /* User */
+ $data_return['request'] = wp_remote_get( 'https://api.github.com/users/' . explode("/", $slug)[0] );
+ $data_return['type'] = "user";
+ break;
+
+ case 2:
+ /* Repo */
+ $data_return['request'] = wp_remote_get( 'https://api.github.com/repos/' . $slug );
+ $data_return['type'] = "repo";
+ break;
+
+ default:
+ /* ??? */
+ /*
+ $data_return['request'] = "";
+ $data_return['type'] = "";
+ */
+ $data_return = NULL;
+ }
+ return $data_return;
+
+ }
+
+
public function ebg_embed_repository( $attributes ) {
$github_url = trim( $attributes['github_url'] );
- $darck_mode = (in_array("darck_mode", $attributes) ? $attributes['darck_mode'] : false);
+ $darck_theme = (in_array("darck_theme", $attributes) ? $attributes['darck_theme'] : false);
+ $icon_type_source = (! empty($attributes['icon_type_source']) ? $attributes['icon_type_source'] : "file_svg");
- $a_remplace = [];
- $a_remplace['%%_WRAPPER_DARK_MODE_%%'] = "ebg-br-wrapper-dark-mode-" . ($darck_mode ? "on" : "off");
+ $transient_id = $this::transient_id("", sanitize_title_with_dashes( $github_url ) );
+ $transi = new embed_block_for_github_transient($transient_id, true);
- if ( '' === trim( $github_url ) ) {
- $content = '' . esc_html__( 'Use the Sidebar to add the URL of the GitHub Repository to embed.', 'embed-block-for-github' ) . '
';
- } else {
-
- if ( filter_var( $github_url, FILTER_VALIDATE_URL ) ) {
- if ( strpos( $github_url, 'https://github.com/' ) === 0 ) {
- if ( get_transient( '_ebg_repository_' . sanitize_title_with_dashes( $github_url ) ) )
+ /* We check and validate the propiedases are good. */
+ $error['type'] = $this::check_github_url($github_url);
+
+ /* If no errors have been detected, we obtain the data from github. */
+ if (empty($error['type']))
+ {
+ /* DEV: CLEAN TRANSIENT */
+ if ($this->dev_mode) {
+ $transi->delete(true);
+ }
+ /* DEV: CLEAN TRANSIENT */
+
+ if (! $transi->isExist() )
+ {
+ $data_all = $this::detect_request($github_url);
+
+ if (! is_null( $data_all ) )
+ {
+ $body = wp_remote_retrieve_body( $data_all['request'] );
+ $data_all['data'] = json_decode( $body );
+
+ if (! is_wp_error( $response ) ) {
+ $transi->set($data_all);
+ } else {
+ $error['type'] = "info_no_available";
+ //$response->get_error_message()
+ }
+ unset($body);
+ } else
+ {
+ $error['type'] = "url_not_valid";
+ }
+ }
+
+ if (empty($error['type']))
+ {
+ $data_all = $transi->get();
+
+ if (isset($data_all->data))
+ {
+ /* We check if any error has been received from github. */
+ if (isset( $data_all->data->message ) )
{
- $data = json_decode( get_transient( '_ebg_repository_' . sanitize_title_with_dashes( $github_url ) ) );
- if (isset( $data->message ) )
- {
- $content = $this->check_message($data->message);
- }
- else {
- $content = $this->process_template('repository.php', $data);
- $a_remplace['%%_DATA_AVATAR_URL_%%'] = $data->owner->avatar_url;
- $a_remplace['%%_DATA_REPO_URL_%%'] = $data->html_url;
- $a_remplace['%%_DATA_REPO_NAME_%%'] = $data->name;
- $a_remplace['%%_DATA_AUTOR_URL_%%'] = $data->owner->html_url;
- $a_remplace['%%_DATA_AUTOR_NAME_%%'] = $data->owner->login;
- $a_remplace['%%_DATA_DESCIPTION_%%'] = $data->description;
- }
- unset($data);
- }
- else {
- $slug = str_replace( 'https://github.com/', '', $github_url );
- $request = wp_remote_get( 'https://api.github.com/repos/' . $slug );
-
- $body = wp_remote_retrieve_body( $request );
- $data = json_decode( $body );
- if ( ! is_wp_error( $response ) ) {
- set_transient( '_ebg_repository_' . sanitize_title_with_dashes( $github_url ), json_encode( $data ) );
- if (isset( $data->message ) )
- {
- $content = $this->check_message($data->message);
- }
- else {
- $content = $this->process_template('repository.php', $data);
-
- $a_remplace['%%_DATA_AVATAR_URL_%%'] = $data->owner->avatar_url;
- $a_remplace['%%_DATA_REPO_URL_%%'] = $data->html_url;
- $a_remplace['%%_DATA_REPO_NAME_%%'] = $data->name;
- $a_remplace['%%_DATA_AUTOR_URL_%%'] = $data->owner->html_url;
- $a_remplace['%%_DATA_AUTOR_NAME_%%'] = $data->owner->login;
- $a_remplace['%%_DATA_DESCIPTION_%%'] = $data->description;
- }
- } else {
- $content = '' . esc_html__( 'No information available. Please check your URL.', 'embed-block-for-github' ) . '
';
- }
- unset($data);
+ $error['type'] = "get_error_from_github";
+ $error['msg_custom'] = $this::check_message($data_all->data->message, $data_all->data->documentation_url);
+ }
+
+ /* If all went well, we loaded the template and generated the replacements. */
+ $content = $this::template_generate_info($data_all, $a_remplace);
+ if (is_null($content)) {
+ $error['type'] = "url_not_valid";
}
- } else {
- $content = '' . esc_html__( 'Use the Sidebar to add the URL of the GitHub Repository to embed.', 'embed-block-for-github' ) . '
';
}
+
+ unset($data_all);
+ }
+ }
+
+ /* If there is an error, we prepare the error message that has been detected. */
+ if (! empty($error['type'])) {
+ /* Clean Transient is error detected. */
+ $transi->delete(true);
+
+ $content = $this::template_file_require('msg-error.php');
+ $a_remplace['%%_ERROR_TITLE_%%'] = "ERROR";
+ if (empty($error['msg_custom'])) {
+ $a_remplace['%%_ERROR_MESSAGE_%%'] = $this::message($error['type']);
} else {
- $content = '' . esc_html__( 'Use the Sidebar to add the URL of the GitHub Repository to embed.', 'embed-block-for-github' ) . '
';
+ $a_remplace['%%_ERROR_MESSAGE_%%'] = $error['msg_custom'];
}
}
+ unset ($transi);
+
+ /* If "$content" is not empty, we execute the replaces in the template. */
+ if (! empty($content)) {
+ $a_remplace['%%_CFG_DARK_THEME_%%'] = "ebg-br-cfg-dark-theme-" . ($darck_theme ? "on" : "off");
+ $a_remplace['%%_CFG_ICON_TYPE_SOURCE_-_FILE_SVG_%%'] = ($icon_type_source == "file_svg" ? "ebg-br-cfg-icon-type-source-file_svg" : "ebg-br-hide");
+ $a_remplace['%%_CFG_ICON_TYPE_SOURCE_-_FONT_AWESOME_%%'] = ($icon_type_source == "font_awesome" ? "ebg-br-cfg-icon-type-source-font_awesome" : "ebg-br-hide");
+ $a_remplace['%%_URL_ICO_LINK_%%'] = $this::plugin_url("public/images/link.svg");
- foreach ($a_remplace as $key => $val) {
- $content = str_replace($key, $val, $content);
+ foreach ($a_remplace as $key => $val) {
+ $content = str_replace($key, $val, $content);
+ }
+ return $content;
+ }
+ }
+
+ private function template_file_require( $template, $data = array() ) {
+ ob_start();
+ if ( ! locate_template( $this->plugin_name() . '/' . $template, true, false) ) {
+ $filename = $this::plugin_path() . 'templates/' . $template;
+ if (! file_exists( $filename ) ) {
+ return NULL;
+ }
+ require $filename;
+ }
+ return ob_get_clean();
+ }
+
+ private function template_collect_values_to_replace($data, $prefix_text, &$a_remplace) {
+ foreach ($data as $key => $value) {
+ $new_prefix_text = $prefix_text."_".strtoupper($key);
+ //echo "Debug >> Key:". $key . " - Valor Tipo:" . gettype($value) . " ";
+ if (is_object($value)) {
+ $this->{__FUNCTION__}($value, $new_prefix_text, $a_remplace);
+ } else {
+ $a_remplace[$new_prefix_text.'_%%'] = $value;
+ $a_remplace[$new_prefix_text.'_%_CLASS_HIDE_IS_NULL_%%'] = (empty(trim($value)) ? "ebg-br-hide": "");
+ }
+ }
+ }
+
+ private function template_generate_info($data_all, &$a_remplace) {
+ // https://api.github.com/users/vsc55
+ // https://api.github.com/repos/vsc55/embed-block-for-github
+
+ $name_file = 'info-'.strtolower($data_all->type).'.php';
+ $content = $this::template_file_require($name_file, $data_all->data);
+ if ( (! is_null($content)) && (! empty($content)) )
+ {
+ switch(strtolower($data_all->type))
+ {
+ case "user":
+ $a_remplace['%%_CUSTOM_DATA_USER_CREATED_AT_ONLY_DATE_%%'] = date_format( date_create( $data_all->data->created_at ), 'd/m/Y');
+ $a_remplace['%%_CUSTOM_DATA_USER_CREATED_AT_ONLY_DATE_%_CLASS_HIDE_IS_NULL_%%'] = (empty($data_all->data->created_at) ? "ebg-br-hide": "");
+ $a_remplace['%%_CUSTOM_DATA_USER_UPDATED_AT_ONLY_DATE_%%'] = date_format( date_create( $data_all->data->updated_at ), 'd/m/Y');
+ $a_remplace['%%_CUSTOM_DATA_USER_UPDATED_AT_ONLY_DATE_%_CLASS_HIDE_IS_NULL_%%'] = (empty($data_all->data->updated_at) ? "ebg-br-hide": "");
+ break;
+ case "repo":
+ break;
+ }
+ $this::template_collect_values_to_replace($data_all->data, "%%_DATA_".strtoupper($data_all->type), $a_remplace);
}
return $content;
}
}
+require_once ( __DIR__ . '/includes/embed_block_for_github_transient.php' );
+
$embed_block_for_github = new embed_block_for_github();
\ No newline at end of file
diff --git a/images/on_off.svg b/images/on_off.svg
deleted file mode 100644
index 4a40dee..0000000
--- a/images/on_off.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/includes/embed_block_for_github_transient.php b/includes/embed_block_for_github_transient.php
new file mode 100644
index 0000000..9972426
--- /dev/null
+++ b/includes/embed_block_for_github_transient.php
@@ -0,0 +1,51 @@
+id = $id;
+ $this->enabled = $enabled;
+ }
+
+ function isSetId() {
+ return (! empty( $this->id ) );
+ }
+
+ function isExist() {
+ if ( ( $this->enabled ) && ( $this->isSetId() ) && ( get_transient($this->id) ) ) {
+ return true;
+ }
+ return false;
+ }
+
+ function get() {
+ if ( ( $this->enabled ) && ( $this->isSetId() ) ) {
+ return json_decode( get_transient( $this->id ) );
+ }
+ }
+
+ function set ($data) {
+ if ( ( $this->enabled ) && ( $this->isSetId() ) ) {
+ set_transient( $this->id, json_encode( $data ) );
+ return True;
+ }
+ return False;
+ }
+
+ function delete ($force = false) {
+ if ( ( $this->enabled ) || ( $force ) ) {
+ if ( $this->isExist() ) {
+ delete_transient( $this->id );
+ }
+ }
+
+ }
+
+}
diff --git a/includes/index.php b/includes/index.php
new file mode 100644
index 0000000..e71af0e
--- /dev/null
+++ b/includes/index.php
@@ -0,0 +1 @@
+ TOOLS
+*/
+.ebg-br-wrapper .ebg-br-editmode {
+ display: none;
+}
+
+.ebg-br-wrapper .ebg-br-hide {
+ display: none !important;
+}
+
+
+/*
+ CSS > Body
+*/
+.ebg-br-wrapper .ebg-br-border {
+ margin: 1em 0 1.5em 0;
+ padding: 1em;
+ box-shadow: 10px 10px 15px 0px rgba(0,0,0,0.75);
+ border-radius: .5em;
+}
+
+.ebg-br-wrapper .ebg-br-body {
+ position: relative;
+ display: flex;
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-off .ebg-br-border {
+ border: 1px solid #eee;
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-on .ebg-br-border {
+ border: 1px solid rgba(94,9,9,1);
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-off .ebg-br-background-color {
+ background-color: whitesmoke;
+ /*color: black;*/
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-on .ebg-br-background-color {
+ background-color: #333333;
+ /*color: whitesmoke;*/
+}
+
+
+/*
+ CSS > Icon and Logo GitHub
+*/
+
+.ebg-br-wrapper .ebg-br-logo.ebg-br-icon-github,
+.ebg-br-wrapper .ebg-br-logo.fab.fa-github {
+ position: absolute;
+ top: 0.5em;
+ right: 0.5em;
+ font-size: 20px;
+}
+
+.ebg-br-wrapper .ebg-br-logo.ebg-br-icon-github {
+ background-repeat: no-repeat;
+ background-position: top left;
+ background-size: 100% auto;
+ display: inline-block;
+ float: none;
+ width: 20px;
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-off .ebg-br-icon,
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-off .ebg-br-logo.fab.fa-github {
+ color: black;
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-on .ebg-br-icon,
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-on .ebg-br-logo.fab.fa-github {
+ color: white;
+}
+
+.ebg-br-wrapper .ebg-br-icon-github {
+ background-image: url('../images/github.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-subscribers {
+ background-image: url('../images/subscribe.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-watchers {
+ background-image: url('../images/watch.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-forks {
+ background-image: url('../images/fork.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-link {
+ background-image: url('../images/link.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-location {
+ background-image: url('../images/location.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-email {
+ background-image: url('../images/email.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-company {
+ background-image: url('../images/building.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-create {
+ /*background-image: url('../images/create.svg');*/
+ background-image: url('../images/clock.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-public_repo {
+ background-image: url('../images/public_repo.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-public_gists {
+ background-image: url('../images/code.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-followers {
+ background-image: url('../images/team.svg');
+}
+
+.ebg-br-wrapper .ebg-br-icon-following {
+ background-image: url('../images/team.svg');
+}
+
+
+/*
+ CSS > Columns Sidebar, Main
+*/
+.ebg-br-wrapper .ebg-br-col {
+ display: inline-block;
+ margin: 0;
+ padding: 0;
+}
+
+.ebg-br-wrapper .ebg-br-col.ebg-br-col-sidebar {
+ min-width: 150px;
+}
+
+.ebg-br-wrapper .ebg-br-col.ebg-br-col-main {
+ width: 100%;
+}
+
+
+/*
+ CSS > Avatar
+*/
+.ebg-br-wrapper .ebg-br-col.ebg-br-col-sidebar {
+ margin: 0 1em 0 0;
+}
+
+.ebg-br-wrapper .ebg-br-header-avatar {
+ max-width: 150px;
+ border-radius: 50%;
+ box-shadow: 10px 10px 15px 0px rgba(0,0,0,0.75);
+}
+
+
+/*
+ CSS > All Template
+*/
+.ebg-br-wrapper .ebg-br-col-main .ebg-br-title {
+ margin: 0;
+ padding: 0;
+ line-height: 1.2em;
+}
+
+.ebg-br-wrapper .ebg-br-col-main .ebg-br-title strong {
+ display: block;
+ font-size: 1.5em;
+}
+
+.ebg-br-wrapper .ebg-br-col-main .ebg-br-title em {
+ display: block;
+ font-size: .8em;
+ padding-top: 0.25em;
+}
+
+.ebg-br-wrapper .ebg-br-col-main a,
+.ebg-br-wrapper .ebg-br-col-main a:hover,
+.ebg-br-wrapper .ebg-br-col-main a:focus,
+.ebg-br-wrapper .ebg-br-col-main a:active {
+ text-decoration: none;
+}
+
+.ebg-br-wrapper .ebg-br-col-main .ebg-br-description {
+ margin: .5em 0 0;
+ padding: 0;
+ font-size: 0.9em;
+ line-height: 1.2em;
+}
+
+.ebg-br-wrapper .ebg-br-icon.ebg-br-cfg-icon-type-source-file_svg {
+ background-repeat: no-repeat;
+ background-position: center center;
+ background-size: 100% auto;
+ display: inline-block;
+ float: none;
+ width: 15px;
+}
+
+.ebg-br-wrapper .ebg-br-inverter-color,
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-on .ebg-br-img-color-auto {
+ -webkit-filter: invert(100%);
+ -moz-filter: invert(100%);
+ -o-filter: invert(100%);
+ -ms-filter: invert(100%);
+ filter: invert(100%);
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-off .ebg-br-img-color-auto {
+ -webkit-filter: invert(0);
+ -moz-filter: invert(0);
+ -o-filter: invert(0);
+ -ms-filter: invert(0);
+ filter: invert(0);
+}
+
+.ebg-br-wrapper .screen-reader-text {
+ border: 0;
+ clip: rect(1px, 1px, 1px, 1px);
+ clip-path: inset(50%);
+ height: 1px;
+ margin: -1px;
+ overflow: hidden;
+ padding: 0;
+ position: absolute;
+ width: 1px;
+ word-wrap: normal !important;
+}
+
+/*
+ CSS > Template Error
+*/
+.ebg-br-wrapper .ebg-br-template-error .ebg-br-col.ebg-br-col-sidebar {
+ display: none !important;
+}
+
+.ebg-br-wrapper .ebg-br-template-error .ebg-br-col.ebg-br-col-main {
+ padding-left: 60px;
+ padding-top: 0.5em;
+ background-image: url('../images/logo-error.png');
+ background-repeat: no-repeat;
+ background-size: auto 50px;
+ background-position: left top;
+}
+
+
+/*
+ CSS > Template Repo
+*/
+.ebg-br-wrapper .ebg-br-template-repo .ebg-br-description {
+ font-size: 1.1em;
+}
+
+.ebg-br-wrapper .ebg-br-template-repo .ebg-br-footer {
+ margin: 1em 0 0;
+ padding: 0;
+ padding-left: 1.5em;
+ line-height: 1.2em;
+}
+
+.ebg-br-wrapper .ebg-br-template-repo .ebg-br-footer > span {
+ margin-right: 0.5em;
+ font-size: 0.9em;
+}
+
+.ebg-br-wrapper .ebg-br-template-repo .ebg-br-footer .ebg-br-link {
+ display: block;
+ margin: .5em 0 0;
+}
+
+.ebg-br-wrapper .ebg-br-template-repo .ebg-br-footer .ebg-br-icon.ebg-br-cfg-icon-type-source-font_awesome {
+ font-size: 1em;
+}
+
+
+/*
+ CSS > Template User
+*/
+.ebg-br-wrapper .ebg-br-template-user .ebg-br-description {
+ font-size: 1.1em;
+}
+
+.ebg-br-wrapper .ebg-br-template-user .ebg-br-box-ul {
+ padding-top: 0.5em;
+ padding-left: 1em;
+ width: calc(90% - 1em);
+ vertical-align: middle;
+}
+
+.ebg-br-wrapper .ebg-br-template-user .ebg-br-box-ul ul {
+ margin: 0;
+ margin-bottom: 10px;
+ padding: 0.5em;
+ overflow: hidden;
+ list-style-type: none;
+
+ box-shadow: 10px 10px 15px 0px rgba(0,0,0,0.75);
+ border-radius: .5em;
+}
+
+.ebg-br-wrapper .ebg-br-template-user .ebg-br-box-ul ul > li {
+ display: inline-block;
+ margin-right: 0.5em;
+ padding-top: 0.5em;
+ padding-left: 0.5em;
+}
+
+.ebg-br-wrapper .ebg-br-template-user .ebg-br-box-ul ul > li > i {
+ padding-right: 0.25em;
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-off.ebg-br-template-user .ebg-br-box-ul ul {
+ border: 1px solid #eee;
+ background-color: white;
+}
+
+.ebg-br-wrapper .ebg-br-cfg-dark-theme-on.ebg-br-template-user .ebg-br-box-ul ul {
+ border: 1px solid rgba(94,9,9,1);
+ background-color: #1d201d;
+}
+
+.ebg-br-wrapper .ebg-br-template-user .ebg-br-icon.ebg-br-cfg-icon-type-source-file_svg {
+ width: 12px !important;
+}
diff --git a/public/images/building.svg b/public/images/building.svg
new file mode 100644
index 0000000..d5a456c
--- /dev/null
+++ b/public/images/building.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/public/images/clock.svg b/public/images/clock.svg
new file mode 100644
index 0000000..059e1cd
--- /dev/null
+++ b/public/images/clock.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/public/images/code.svg b/public/images/code.svg
new file mode 100644
index 0000000..75df486
--- /dev/null
+++ b/public/images/code.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/public/images/date.svg b/public/images/date.svg
new file mode 100644
index 0000000..69e44ac
--- /dev/null
+++ b/public/images/date.svg
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/public/images/email.svg b/public/images/email.svg
new file mode 100644
index 0000000..803d2d5
--- /dev/null
+++ b/public/images/email.svg
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/images/fork.svg b/public/images/fork.svg
old mode 100755
new mode 100644
similarity index 100%
rename from images/fork.svg
rename to public/images/fork.svg
diff --git a/images/github.svg b/public/images/github.svg
old mode 100755
new mode 100644
similarity index 100%
rename from images/github.svg
rename to public/images/github.svg
diff --git a/public/images/index.php b/public/images/index.php
new file mode 100644
index 0000000..e71af0e
--- /dev/null
+++ b/public/images/index.php
@@ -0,0 +1 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/public/images/location.svg b/public/images/location.svg
new file mode 100644
index 0000000..c90843a
--- /dev/null
+++ b/public/images/location.svg
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/public/images/logo-error.png b/public/images/logo-error.png
new file mode 100644
index 0000000..7c64f33
Binary files /dev/null and b/public/images/logo-error.png differ
diff --git a/public/images/public_repo.svg b/public/images/public_repo.svg
new file mode 100644
index 0000000..fd623c8
--- /dev/null
+++ b/public/images/public_repo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/images/subscribe.svg b/public/images/subscribe.svg
old mode 100755
new mode 100644
similarity index 100%
rename from images/subscribe.svg
rename to public/images/subscribe.svg
diff --git a/public/images/team.svg b/public/images/team.svg
new file mode 100644
index 0000000..4bfd2f8
--- /dev/null
+++ b/public/images/team.svg
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/images/watch.svg b/public/images/watch.svg
old mode 100755
new mode 100644
similarity index 100%
rename from images/watch.svg
rename to public/images/watch.svg
diff --git a/public/index.php b/public/index.php
new file mode 100644
index 0000000..e71af0e
--- /dev/null
+++ b/public/index.php
@@ -0,0 +1 @@
+ .ebg-br-background-image {
- background-image: url('images/github.svg');
- background-repeat: no-repeat;
- background-position: calc(100% - 0.5em) 0.5em;
- background-size: 20px 20px;
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
-}
-
-.ebg-br-wrapper-dark-mode-on > .ebg-br-background-image {
- -webkit-filter: invert(100%);
- -moz-filter: invert(100%);
- -o-filter: invert(100%);
- -ms-filter: invert(100%);
- filter: invert(100%);
-}
-
-.ebg-br-wrapper .ebg-br-avatar {
- display: inline-block;
- margin: 0 1em 0 0;
- min-width: 150px;
-}
-
-.ebg-br-wrapper .ebg-br-header-avatar {
- max-width: 150px;
- border-radius: 50%;
-}
-
-.ebg-br-wrapper .ebg-br-avatar .ebg-br-header-avatar {
-}
-
-.ebg-br-wrapper .ebg-br-main {
- display: inline-block;
- margin: 0;
- padding: 0;
-}
-
-.ebg-br-wrapper .ebg-br-title {
- margin: 0;
- padding: 0;
- line-height: 1.2em;
-}
-
-.ebg-br-wrapper .ebg-br-title strong {
- display: block;
- font-size: 1.5em;
-}
-
-.ebg-br-wrapper .ebg-br-title em {
- display: block;
- font-size: .8em;
-}
-
-.ebg-br-wrapper .ebg-br-title a {
-}
-
-.ebg-br-wrapper .ebg-br-title a:hover, .ebg-br-title a:focus, ebg-br-title a:active {
-}
-
-.ebg-br-wrapper .ebg-br-description {
- margin: .5em 0 0;
- padding: 0;
- font-size: 0.9em;
- line-height: 1.2em;
-}
-
-.ebg-br-wrapper .ebg-br-footer {
- margin: 1em 0 0;
- padding: 0;
- line-height: 1.2em;
-}
-
-.ebg-br-wrapper .ebg-br-footer .ebg-br-background-image {
- background-repeat: no-repeat;
- background-position: left center;
- background-size: 18px 18px;
- padding-left: 21px;
- margin-right: 0.5em;
- font-size: 0.9em;
-}
-
-.ebg-br-wrapper .ebg-br-footer .ebg-br-subscribers .ebg-br-background-image {
- background-image: url('images/subscribe.svg');
-}
-
-.ebg-br-wrapper .ebg-br-footer .ebg-br-watchers .ebg-br-background-image {
- background-image: url('images/watch.svg');
-}
-
-.ebg-br-wrapper .ebg-br-footer .ebg-br-forks .ebg-br-background-image {
- background-image: url('images/fork.svg');
-}
-
-.ebg-br-wrapper-dark-mode-on .ebg-br-footer .ebg-br-background-image {
- -webkit-filter: invert(100%);
- -moz-filter: invert(100%);
- -o-filter: invert(100%);
- -ms-filter: invert(100%);
- filter: invert(100%);
-}
-
-.ebg-br-wrapper .ebg-br-link {
- display: block;
- margin: .5em 0 0;
-}
-
-.ebg-br-wrapper .screen-reader-text {
- border: 0;
- clip: rect(1px, 1px, 1px, 1px);
- clip-path: inset(50%);
- height: 1px;
- margin: -1px;
- overflow: hidden;
- padding: 0;
- position: absolute;
- width: 1px;
- word-wrap: normal !important;
-}
\ No newline at end of file
diff --git a/repository-block.js b/repository-block.js
deleted file mode 100755
index edbe1b9..0000000
--- a/repository-block.js
+++ /dev/null
@@ -1,98 +0,0 @@
-( function (blocks, editor, components, i18n, element ) {
-
- var el = wp.element.createElement
- var registerBlockType = wp.blocks.registerBlockType
- var BlockControls = wp.editor.BlockControls
- var AlignmentToolbar = wp.editor.AlignmentToolbar
- var MediaUpload = wp.editor.MediaUpload
- var InspectorControls = wp.editor.InspectorControls
- var TextControl = components.TextControl
- var ToggleControl = wp.components.ToggleControl
- var ServerSideRender = components.ServerSideRender
- var withState = wp.compose.withState
-
- var github_icon =
- el( 'svg' ,
- {
- },
- el( 'path',
- {
- 'd': 'M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'
- }
- )
- )
-
- registerBlockType( 'embed-block-for-github/repository', {
- title: i18n.__( 'GitHub Repo' ),
- description: i18n.__( 'A block to embed a GitHub Repository.' ),
- icon: github_icon,
- keywords: [ i18n.__( 'github' ), i18n.__( 'repository' ), i18n.__( 'repo' ) ],
- category: 'embed',
- attributes: {
- github_url: {
- type: 'string',
- },
- darck_mode: {
- type: 'boolean',
- default: false,
- },
- },
-
- edit: function ( props ) {
- var attributes = props.attributes
- var github_url = props.attributes.github_url
- var darck_mode = props.attributes.darck_mode
-
- return [
- el( 'div', { className: 'components-block-description' },
- el( ServerSideRender, {
- block: 'embed-block-for-github/repository',
- attributes: props.attributes
- } )
- ),
- el(
- InspectorControls,
- { key: 'inspector' },
- el(
- components.PanelBody, {
- title: i18n.__( 'GitHub Repository' ),
- className: 'block-github-repository',
- initialOpen: true
- },
- el(
- TextControl, {
- type: 'text',
- label: i18n.__( 'Enter the URL of the GitHub Repository' ),
- value: github_url,
- onChange: function ( new_url ) {
- props.setAttributes( { github_url: new_url } )
- }
- }
- ),
- el (
- ToggleControl, {
- label: i18n.__( 'Activate Dark Mode' ),
- checked: darck_mode,
- onChange: function ( new_mode ) {
- props.setAttributes( { darck_mode: new_mode } )
- }
- }
- ),
- )
- ),
- ]
- },
-
- save: () => {
- return null
- }
-
-})
-
-})(
- window.wp.blocks,
- window.wp.editor,
- window.wp.components,
- window.wp.i18n,
- window.wp.element
-)
\ No newline at end of file
diff --git a/templates/index.php b/templates/index.php
new file mode 100644
index 0000000..e71af0e
--- /dev/null
+++ b/templates/index.php
@@ -0,0 +1 @@
+
+
+
\ No newline at end of file
diff --git a/templates/info-user.php b/templates/info-user.php
new file mode 100644
index 0000000..8e1637e
--- /dev/null
+++ b/templates/info-user.php
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+ %%_DATA_USER_NAME_%% (%%_DATA_USER_ID_%%)
+ ()
+
+
+
+
+ %%_DATA_USER_LOGIN_%%
+ ()
+
+
+
+
%%_DATA_USER_BIO_%%
+
+
+
+
+
+ %%_DATA_USER_FOLLOWERS_%% Followers
+
+
+
+
+
+ %%_DATA_USER_FOLLOWING_%% Following
+
+
+
+
+
+
+
+
+ %%_CUSTOM_DATA_USER_CREATED_AT_ONLY_DATE_%%
+
+
+
+
+
+ %%_DATA_USER_COMPANY_%%
+
+
+
+
+
+ %%_DATA_USER_LOCATION_%%
+
+
+
+
+
+
+ %%_DATA_USER_BLOG_%%
+ ()
+
+
+
+
+
+
+ %%_DATA_USER_EMAIL_%%
+
+
+
+
+
+
+
+
+ %%_DATA_USER_PUBLIC_REPOS_%% Public Repos
+
+
+
+
+ %%_DATA_USER_PUBLIC_GISTS_%% Public Gists
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/msg-error.php b/templates/msg-error.php
new file mode 100644
index 0000000..9d7e06e
--- /dev/null
+++ b/templates/msg-error.php
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+ %%_ERROR_TITLE_%%
+
+
%%_ERROR_MESSAGE_%%
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/repository.php b/templates/repository.php
deleted file mode 100644
index e9fb648..0000000
--- a/templates/repository.php
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
- Dark Mode
-
-
-
-
-
-
\ No newline at end of file