PluginProbe
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager / 1.2
FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager v1.2
10.56 1.2.1 10 10.1 10.2 10.3 10.31 10.32 10.33 10.34 10.50 10.51 10.52 10.53 10.55 9.0 9.0.1 9.4 trunk 1.0.0 1.1 1.2
easy-code-manager / models / coupling.php

coupling.php in FluentSnippets – High-Performance Code Snippets, Header & Footer Code, Custom CSS & PHP Code Manager 1.2, at models/coupling.php

130 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 // Disallow direct access.
7 defined('ABSPATH') or die("Access denied");
8
9 // Import dependencies.
10 cssJSToolbox::import('tables:blocks.php');
11
12 /**
13 *
14 */
15 class CJTCouplingModel extends CJTHookableClass {
16
17 /**
18 * put your comment there...
19 *
20 * @var mixed
21 */
22 protected $onexpressionsandlinkedblocks = array('parameters' => array('blocks'));
23
24 /**
25 * put your comment there...
26 *
27 * @var mixed
28 */
29 protected $ongetorder = array('parameters' => array('order'));
30
31 /**
32 * put your comment there...
33 *
34 * @var mixed
35 */
36 protected $onpinsblockfilters = array('parameters' => array(
37 'params' => array('linksExpressionFlag', 'pinPoint', 'customPins')
38 )
39 );
40
41 /**
42 * put your comment there...
43 *
44 * @var mixed
45 */
46 protected $onrequestblocks = array('parameters' => array('blocks'));
47
48 /**
49 * put your comment there...
50 *
51 * @param mixed $id
52 */
53 public function getBlockCode($id) {
54 // Initialize.
55 $code = '';
56 // Initialize.
57 $tblCodeFiles = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver());
58 // Query Block Code Files.
59 $codeFiles = $tblCodeFiles->set('blockId', $id)
60 ->fetchAll();
61 // Merge all code files.
62 foreach ($codeFiles as $codeFile) {
63 // Wrap by Tag + Merge files.
64 $code .= $codeFile['tag'] ? sprintf($codeFile['tag'], " {$codeFile['code']} ") : $codeFile['code'];
65 }
66 // Return final code text.
67 return $code;
68 }
69
70 /**
71 * put your comment there...
72 *
73 */
74 public function getOrder() {
75 return $this->ongetorder(get_option('meta-box-order_ecm'));
76 }
77
78 /**
79 * put your comment there...
80 *
81 * @param mixed $pinPoint
82 * @param mixed $customPins
83 * @param mixed $hookParams
84 */
85 public function getPinsBlocks( $pinPoint, $customPins, $hookParams )
86 {
87 // Extendable!
88 extract( $this->onpinsblockfilters( compact( 'linksExpressionFlag', 'pinPoint', 'customPins' ) ) );
89
90 // Import required libraries for CJTPinsBlockSQLView.
91 require_once CJTOOLBOX_TABLES_PATH . '/pins-blocks-view.php';
92
93 // Initialize new CJTPinsBlockSQLView view object.
94 $dbDriver = new CJTMYSQLQueueDriver( $GLOBALS[ 'wpdb' ] );
95 $view = new CJTPinsBlockSQLView( $dbDriver );
96
97 // Apply filter to view.
98 $view->filters( $pinPoint, $customPins );
99
100 # Allow Plugins/Extensions to change block core query
101 do_action(
102
103 CJTPluggableHelper::ACTION_BLOCK_QUERY_BLOCKS,
104
105 $view,
106
107 $hookParams
108
109 );
110
111 // retreiving blocks data associated with current request.
112 $blocks = $this->onrequestblocks( $view->exec() );
113
114 # Filter queue blocks
115 $blocks = apply_filters(
116 CJTPluggableHelper::FILTER_BLOCKS_COUPLING_MODEL_BLOCKS_QUEUE,
117 $blocks,
118 $hookParams
119 );
120
121 $blocks = apply_filters(CJTPluggableHelper::FILTER_BLOCKS_COUPLING_MODEL_QUERY_MORE_BLOCKS, $blocks, $view);
122
123 return $blocks;
124 }
125
126 } // End class.
127
128
129 // Hookable!
130 CJTCouplingModel::define('CJTCouplingModel', array('hookType' => CJTWordpressEvents::HOOK_FILTER));