Skip to content

Commit

Permalink
Merge pull request #34 from navnorth/stage
Browse files Browse the repository at this point in the history
WP-48 - GitHub Deployment to WP Repository
  • Loading branch information
joehobson authored Aug 5, 2021
2 parents affef15 + 74b331d commit 5648b7c
Show file tree
Hide file tree
Showing 106 changed files with 3,932 additions and 3,232 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: Deploy to WordPress.org
on:
push:
tags:
- '*'
push:
tags:
- "*"

workflow_dispatch:
jobs:
tag:
name: WordPress.org Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: WordPress Plugin Deploy
uses: 10up/actions-wordpress/dotorg-plugin-deploy@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: open-educational-resources
tag:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build # Remove or modify this step as needed
run: |
npm install
npm run build
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: open-educational-resources
5 changes: 1 addition & 4 deletions Excel/oleread.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ function read($sFileName){
}
}

// var_dump($bigBlockDepotBlocks);

// readBigBlockDepot
$pos = 0;
$index = 0;
Expand All @@ -125,7 +123,6 @@ function read($sFileName){
}
}

//var_dump($this->bigBlockChain);
//echo '=====2';
// readSmallBlockDepot();
$pos = 0;
Expand Down Expand Up @@ -180,7 +177,7 @@ function __readData($bl) {

function __readPropertySets(){
$offset = 0;
//var_dump($this->entry);

while ($offset < strlen($this->entry)) {
$d = substr($this->entry, $offset, OER_PROPERTY_STORAGE_BLOCK_SIZE);

Expand Down
7 changes: 1 addition & 6 deletions Excel/reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,7 @@ function read($sFileName)
} elseif ($pps->Name == 'Root Entry') {
$this->data = $ole->getData($i, 0, $ole->getDataLength($i));
}
//var_dump(strlen($ole->getData($i, 0, $ole->getDataLength($i))), $pps->Name, md5($this->data), $ole->getDataLength($i));
}
//exit;
$this->_parse();
return sizeof($this->sheets) > 0;
Expand All @@ -399,7 +397,6 @@ function read($sFileName)
$res = $this->_ole->read($sFileName);
if ($this->isError($res)) {
// var_dump($res);
return $this->raiseError($res);
}
Expand Down Expand Up @@ -728,7 +725,7 @@ function _parsesheet($spos)
}
//echo "Start parse code=".base_convert($code,10,16)." version=".base_convert($version,10,16)." substreamType=".base_convert($substreamType,10,16).""."\n";
$spos += $length + 4;
//var_dump($this->formatRecords);

//echo "code $code $length";
while($cont) {
//echo "mem= ".memory_get_usage()."\n";
Expand Down Expand Up @@ -800,7 +797,6 @@ function _parsesheet($spos)
$column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8;
$xfindex = ord($this->data[$spos+4]) | ord($this->data[$spos+5])<<8;
$index = $this->_GetInt4d($this->data, $spos + 6);
//var_dump($this->sst);
$this->addcell($row, $column, $this->sst[$index]);
//echo "LabelSST $row $column $string\n";
break;
Expand Down Expand Up @@ -932,7 +928,6 @@ function isDate($spos)
//$xfindex = GetInt2d(, 4);
$xfindex = ord($this->data[$spos+4]) | ord($this->data[$spos+5]) << 8;
//echo 'check is date '.$xfindex.' '.$this->formatRecords['xfrecords'][$xfindex]['type']."\n";
//var_dump($this->formatRecords['xfrecords'][$xfindex]);
if ($this->formatRecords['xfrecords'][$xfindex]['type'] == 'date') {
$this->curformat = $this->formatRecords['xfrecords'][$xfindex]['format'];
$this->rectype = 'date';
Expand Down
2 changes: 1 addition & 1 deletion blocks/subject-resources-block/build/index.css

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

2 changes: 1 addition & 1 deletion blocks/subject-resources-block/build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion blocks/subject-resources-block/build/style-index.css

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

71 changes: 48 additions & 23 deletions blocks/subject-resources-block/init.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?php
global $pagenow;

function wp_oer_enqueue_subject_resources_frontend_script(){
wp_enqueue_script( 'wp_oer_block-front-js', plugins_url( '/subject-resources-block/build/front.js', dirname( __FILE__ ) ), array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' ),'0.1' , true );
wp_localize_script( 'wp_oer_block-front-js', 'wp_oer_block', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
}
add_action('wp_enqueue_scripts', 'wp_oer_enqueue_subject_resources_frontend_script');
add_action('admin_enqueue_scripts', 'wp_oer_enqueue_subject_resources_frontend_script');

// Add checking if current page is on add new/edit page,post or resource before loading bootstrap
if ($pagenow=="post.php" || $pagenow=="edit.php" || $pagenow=="post-new.php"){
add_action('admin_enqueue_scripts', 'wp_oer_enqueue_subject_resources_frontend_script');
}

/** Subject Resources block version 2.0 **/
function wp_oer_register_resources_block(){
Expand Down Expand Up @@ -91,19 +97,21 @@ function wp_oer_display_subject_resources( $attributes ){
}

$sort_display = "Date Updated";
switch($sort){
case "modified":
$sort_display = 'Date Updated';
break;
case "date":
$sort_display = 'Date Added';
break;
case "title":
$sort_display = 'Title A-Z';
break;
if (isset($sort)){
switch($sort){
case "modified":
$sort_display = 'Date Updated';
break;
case "date":
$sort_display = 'Date Added';
break;
case "title":
$sort_display = 'Title A-Z';
break;
}
}

if (is_array($selectedSubjects))
if (isset($selectedSubjects) && is_array($selectedSubjects))
$selectedSubjects = implode(",", $selectedSubjects);
$heading = '<div class="oer-snglrsrchdng" data-sort="'.$sort.'" data-count="'.$displayCount.'" data-subjects="'.$selectedSubjects.'">';
$heading .= ' Browse '.$displayCount.' resources';
Expand Down Expand Up @@ -135,21 +143,21 @@ function wp_oer_display_subject_resources( $attributes ){
if (is_array($selectedSubjectResources)){
foreach ($selectedSubjectResources as $subject){
$html .= '<div class="post oer-snglrsrc">';
$html .= ' <a href="'.$subject['link'].'" class="oer-resource-link">';
$html .= ' <a href="'.esc_url($subject['link']).'" class="oer-resource-link">';
$html .= ' <div class="oer-snglimglft">';
$html .= ' <img src="'.$subject['fimg_url'].'">';
$html .= ' <img src="'.esc_url($subject['fimg_url']).'">';
$html .= ' </div>';
$html .= ' </a>';
$html .= ' <div class="oer-snglttldscrght">';
$html .= ' <div class="ttl">';
$html .= ' <a href="'.$subject['link'].'">'.$subject['post_title'].'</a>';
$html .= ' <a href="'.esc_url($subject['link']).'">'.$subject['post_title'].'</a>';
$html .= ' </div>';
$html .= ' <div class="post-meta">';
$html .= ' <span class="post-meta-box post-meta-grades">';
$html .= ' <strong>Grades: </strong>'.$subject['oer_grade'];
$html .= ' </span>';
$html .= ' <span class="post-meta-box post-meta-domain">';
$html .= ' <strong>Domain: </strong><a href="'.$subject['oer_resourceurl'].'">'.$subject['domain'].'</a>';
$html .= ' <strong>Domain: </strong><a href="'.esc_url($subject['oer_resourceurl']).'">'.$subject['domain'].'</a>';
$html .= ' </span>';
$html .= ' </div>';
$html .= ' <div class="desc">';
Expand All @@ -160,7 +168,7 @@ function wp_oer_display_subject_resources( $attributes ){
$html .= ' <div class="tagcloud">';
if (is_array($subject['subject_details'])){
foreach($subject['subject_details'] as $subj){
$html .= ' <span><a href="'.$subj['link'].'">'.$subj['name'].'</a></span>';
$html .= ' <span><a href="'.esc_url($subj['link']).'">'.$subj['name'].'</a></span>';
}
}
$html .= ' </div>';
Expand Down Expand Up @@ -364,21 +372,21 @@ function wp_oer_get_subject_resources($args){
if (is_array($resources)){
foreach ($resources as $resource){
$html .= '<div class="post oer-snglrsrc">';
$html .= ' <a href="'.$resource->link.'" class="oer-resource-link">';
$html .= ' <a href="'.esc_url($resource->link).'" class="oer-resource-link">';
$html .= ' <div class="oer-snglimglft">';
$html .= ' <img src="'.$resource->fimg_url.'">';
$html .= ' <img src="'.esc_url($resource->fimg_url).'">';
$html .= ' </div>';
$html .= ' </a>';
$html .= ' <div class="oer-snglttldscrght">';
$html .= ' <div class="ttl">';
$html .= ' <a href="'.$resource->link.'">'.$resource->post_title.'</a>';
$html .= ' <a href="'.esc_url($resource->link).'">'.$resource->post_title.'</a>';
$html .= ' </div>';
$html .= ' <div class="post-meta">';
$html .= ' <span class="post-meta-box post-meta-grades">';
$html .= ' <strong>Grades: </strong>'.$resource->oer_grade;
$html .= ' </span>';
$html .= ' <span class="post-meta-box post-meta-domain">';
$html .= ' <strong>Domain: </strong><a href="'.$resource->oer_resourceurl.'">'.$resource->domain.'</a>';
$html .= ' <strong>Domain: </strong><a href="'.esc_url($resource->oer_resourceurl).'">'.$resource->domain.'</a>';
$html .= ' </span>';
$html .= ' </div>';
$html .= ' <div class="desc">';
Expand All @@ -389,7 +397,7 @@ function wp_oer_get_subject_resources($args){
$html .= ' <div class="tagcloud">';
if (is_array($resource->subject_details)){
foreach($resource->subject_details as $subj){
$html .= ' <span><a href="'.$subj['link'].'">'.$subj['name'].'</a></span>';
$html .= ' <span><a href="'.esc_url($subj['link']).'">'.$subj['name'].'</a></span>';
}
}
$html .= ' </div>';
Expand All @@ -407,4 +415,21 @@ function wp_oer_ajax_get_subject_resources(){
die();
}
add_action( 'wp_ajax_get_subject_resources', 'wp_oer_ajax_get_subject_resources' );
add_action( 'wp_ajax_nopriv_get_subject_resources', 'wp_oer_ajax_get_subject_resources' );
add_action( 'wp_ajax_nopriv_get_subject_resources', 'wp_oer_ajax_get_subject_resources' );

/*
* Add OER Block Category
*/
function wp_oer_block_category( $categories ) {
$category_slugs = wp_list_pluck( $categories, 'slug' );
return in_array( 'oer-block-category', $category_slugs, true ) ? $categories : array_merge(
array(
array(
'slug' => 'oer-block-category',
'title' => __( 'OER Blocks', 'oer-block-category' ),
),
),
$categories
);
}
add_filter( 'block_categories', 'wp_oer_block_category', 10, 2);
Loading

0 comments on commit 5648b7c

Please sign in to comment.