Skip to content

Commit

Permalink
updated to wpoow 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
walisc committed Jan 12, 2023
1 parent 6fff472 commit 3521a99
Show file tree
Hide file tree
Showing 23 changed files with 88 additions and 333 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendors/*
build/
vendor/
build/
.idea/
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"autoload": {
"psr-4": {
"wpOOW": "./src/wpOOW"
"wpOOW\\": "./src/wpOOW"
}
}
}
2 changes: 2 additions & 0 deletions src/wpOOW/Core/Elements/Autoloader.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace wpOOW\Core\Elements;

/**
* Created by PhpStorm.
* User: chidow
Expand Down
9 changes: 7 additions & 2 deletions src/wpOOW/Core/Elements/BaseElement.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php

namespace wpOOW\Core\Elements;


use wpOOW\Core\Permissions\wpAPIPermissions;
use wpOOW\Core\wpAPIObjects;

/**
* Class BaseElement
Expand Down Expand Up @@ -186,7 +191,7 @@ protected function GetElementDirectory()
*/
protected function GetElementURIDirectory()
{
return WP_API_ELEMENT_URI_PATH. get_class($this) . URL_SEPARATOR;
return WP_API_ELEMENT_URI_PATH. (new \ReflectionClass($this))->getShortName(). URL_SEPARATOR;
}

// register events
Expand Down Expand Up @@ -262,7 +267,7 @@ function __construct($id, $label="", $permissions=[], $elementPath = '', $elemen

//TODO: Make this global

$loader = new \Twig\Loader\FilesystemLoader(dirname((new ReflectionClass($this))->getFileName()). $elementPath);
$loader = new \Twig\Loader\FilesystemLoader(dirname((new \ReflectionClass($this))->getFileName()). $elementPath);
$this->twigTemplate = new \Twig\Environment($loader);

wpAPIObjects::GetInstance()->AddObject(sprintf("_element_%s", $this->id), $this);
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/Elements/Checkbox/Checkbox.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\Elements\Checkbox;


use wpOOW\Core\Elements\BaseElement;

/**
* Class Checkbox
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/Elements/Link/Link.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\Elements\Link;


use wpOOW\Core\Elements\BaseElement;

/**
* Class Link
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/Elements/MultiSelect/MultiSelect.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\Elements\MultiSelect;


use wpOOW\Core\Elements\BaseElement;

/**
* Class MultiSelect
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/Elements/RichTextArea/RichTextArea.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\Elements\RichTextArea;


use wpOOW\Core\Elements\BaseElement;

/**
* Class RichTextArea
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/Elements/Select/Select.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\Elements\Select;


use wpOOW\Core\Elements\BaseElement;

/**
* Class Select
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/Elements/Text/Text.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\Elements\Text;


use wpOOW\Core\Elements\BaseElement;

/**
* Class Text
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/Elements/TextArea/TextArea.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\Elements\TextArea;


use wpOOW\Core\Elements\BaseElement;

/**
* Class TextArea
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/Elements/Uploader/Uploader.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\Elements\Uploader;


use wpOOW\Core\Elements\BaseElement;

/**
* Class Uploader
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/Elements/wpAPIDateTime/wpAPIDateTime.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\Elements\wpAPIDateTime;


use wpOOW\Core\Elements\BaseElement;

/**
* Class wpAPIDateTime
Expand Down
2 changes: 2 additions & 0 deletions src/wpOOW/Core/PageTypes/Menu.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace wpOOW\Core\PageTypes;


/**
* Class Menu
Expand Down
7 changes: 7 additions & 0 deletions src/wpOOW/Core/PageTypes/PostType.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

namespace wpOOW\Core\PageTypes;


use wpOOW\Core\Permissions\wpAPIPermissions;
use wpOOW\Core\wpAPIBasePage;
use wpOOW\Core\wpAPIObjects;
use wpOOW\Core\wpQueryObject;

/**
* Class PostType
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/PageTypes/SubMenu.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace wpOOW\Core\PageTypes;


use wpOOW\Core\wpAPIBasePage;

/**
* Class SubMenu
Expand Down
2 changes: 2 additions & 0 deletions src/wpOOW/Core/PageTypes/SubMenuSeparator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace wpOOW\Core\PageTypes;


/**
* Class SubMenuSeparator
Expand Down
4 changes: 4 additions & 0 deletions src/wpOOW/Core/wpAPIBasePage.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php

namespace wpOOW\Core;




use wpOOW\Core\Permissions\wpAPIPermissions;

$CURRENT_VIEW_STATE = wpAPIPermissions::EditPage;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/wpOOW/Core/wpAPIObjects.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace wpOOW\Core;


/**
* Class wpAPIObjects
Expand Down
2 changes: 2 additions & 0 deletions src/wpOOW/Core/wpAPIUtilities.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace wpOOW\Core;


/**
* Class wpAPIUtilities
Expand Down
8 changes: 5 additions & 3 deletions src/wpOOW/Core/wpQueryObject.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace wpOOW\Core;

/**
* Class wpQueryObject
* Creates a query object that acts as a wrapper class to create wp queries with relevant properties for a post types
Expand Down Expand Up @@ -61,7 +63,7 @@ public function OrderBy($fieldname, $asc_desc, $use_numbers=false)
*/
public function Fetch()
{
$loop = new WP_Query( $this->queryArgs );
$loop = new \WP_Query( $this->queryArgs );

while ( $loop->have_posts() ) : $loop->the_post();

Expand All @@ -84,7 +86,7 @@ public function Fetch()
*/

#TODO: Really think about this. The proper way of implementing. The class is no longer generic
class PostTypeRow extends ArrayObject
class PostTypeRow extends \ArrayObject
{

private $parent_slug = "";
Expand Down Expand Up @@ -154,7 +156,7 @@ public function __unset($name)

public function getIterator()
{
return new ArrayIterator($this->storage);
return new \ArrayIterator($this->storage);

}
}
30 changes: 0 additions & 30 deletions src/wpOOW/Utilities/versionDetails.php

This file was deleted.

Loading

0 comments on commit 3521a99

Please sign in to comment.